Problem with a challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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)

1st Apr 2023, 8:32 AM
Glo
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.
1st Apr 2023, 8:42 AM
Kashyap Kumar
Kashyap Kumar - avatar
+ 1
Thanks you
1st Apr 2023, 12:04 PM
Glo