Why doesn’t it stop? Using “or” | SoloLearn: Learn to code for FREE!

+3

Why doesn’t it stop? Using “or”

I can’t figure this out. The code shown below stops at 0. If you change b to “b=-1”, it’s an infinite loop! I added the break so it would t freeze up my program. So why doesn’t the loop keep going when b is 0 also?? Why does it stop? Why wouldnt it stop if b is -1? Help!!!! a=5 b=0 while(a or b): a-=1 if a == -10: break print(a) print(a)

or

5/3/2019 2:48:40 PM

Beau Tooley

1 Answer

New Answer

+6

-1 is True. The only number that is False is 0