m = 0
for i in range(1,1000):
if i % 3 == 0 or i % 5 == 0:
m += m
print m
This gives 0
as answer.
Answer should be 233168
.
Could the line ending in my IDE be an issue? I am using pycharm.
EDIT: note to self - take a break. I found the typo as soon as I posted this. I was having some problem with ide and line ending just before this. anyway thanks :) Troll away
Note the line:
You're adding
m
tom
itself; i.e. you're always adding0
to0
.You probably meant: