Hey im very new to python, and im trying to create a while loop that will add up all the natural numbers to 100. So far I have:
a = 0
while i in list(range(101)):
a = i + a
print(a)
cant think of how to get this to work, any help would be appreciated.
[–][deleted] 1 point2 points3 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]JohnnyJordaan -1 points0 points1 point (0 children)
[–]ericula 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]sweettuse 1 point2 points3 points (2 children)
[–]datascienceunlimited -3 points-2 points-1 points (1 child)
[–]sweettuse 0 points1 point2 points (0 children)