After receiving an error in the code below i ended up adding
new_list = []
summation = 0
after the second line. But i fail to understand why i had to do that. I thought variables did not have to be declared early on in python
a = int(input())
b = int(input())
while a <= b:
if a % 3 == 0:
new_list.append(a)
a += 1
for number in new_list:
summation += int(number)
print(summation / len(new_list))