New course! Every coder should learn Generative AI!
Try a free lesson0
Problem with a challenge
I try to solve a challenge and i should print the sum of the multiple of 3 and 5 below an integer Number(10). What Is the error? sum=0 for i in range(1,10): if i%3==0 or i%5==0: sum=sum+i print(sum)
2 Answers
+ 5
sum=0
for i in range(1,10):
if i%3==0 or i%5==0:
sum=sum+i
print(sum) # HERE
In the last line, you added indentation which makes it part of the if block and for block.
+ 1
Thanks you