Does or condition work in a while loop in python? I can't seem to make it work. This is the sample of how my code works.
newslot = 3
moved = False
while newslot > 0 or moved != True:
enabled = query something on the database where slot = newslot
if enabled:
print 'do something here'
moved = True
else:
newslot-=1
print 'slot disabled'
So when the newslot gets to value of zero it still proceeds to go inside the while loop. I seem to be missing something here.
slot?slotandenabled?oris working but ifslot is enabledis True then, your loop never ends sincenewslot > 0remains Trueandinstead oforormeans when at least one statement isTruethe while loop will continue