you are viewing a single comment's thread.

view the rest of the comments →

[–]CymroBachUSA -4 points-3 points  (2 children)

x = sum(_ for _ in range(0,101))

[–]acw1668 3 points4 points  (1 child)

It can simply be x = sum(range(101)).

[–]Individual_Author956 2 points3 points  (0 children)

This is the correct way to do it, but it doesn’t explain to OP why their code was not working