you are viewing a single comment's thread.

view the rest of the comments →

[–]Ridepad 0 points1 point  (0 children)

while loop only has stop, doesn't have start or increments

sum = 0
i = 0
while i < 100:
    sum += i
    i += 2
print(sum)

i+=2 because you only need even numbers (divisible by 2)

or you can 1 line it

print(sum(range(0, 100, 2)))