- 2
Python White loop Help!!
Hos do I get a sum by using White loop for N numbers
3 Answers
+ 1
How did you try to do that
0
this is what i did :
mystery_int = -7
total =0
i=1
while i <= mystery_int:
total=total+1
i=i+1
print(total)
this seems to only work for positive numbers but what if mystery int is -4 then it should add -4+-3+-2+-1+0
0
Your i is already cannot be less or equal to negative number, so your loop won't do.
I think you're approached it from the wrong side and I struggle to understand how tou intended to achieve anything that way.