[Solved] Python While loop not ending when variable changes [closed]


I read you say that your variable is changing, but where?

Two things: you’ve got to change the variable you’re checking AND you have to change that condition test, that while loop condition is True when the variable var[5] is different than ‘left’ or different that ‘right’ (if it’s “left”, then it’s different than ‘right’ and so the loop will continue)

So…

while var[5].lower() != "left" and var[5].lower() != "right": 
    var[5] = input("Did he go left or right: ")
    print(var[5])

solved Python While loop not ending when variable changes [closed]