while statment is stuck on an infinite loop in python -
task = "" while task != "e" or task != "d": task = raw_input("would encrypt or decrypt\r\n:- ").lower() keyword = raw_input("enter keyword:-").lower() keyphrase = raw_input("enter key phrase:-").lower()
does know why when code runs, while statment looped on , on when correct input has been entered. think parameters in while statment im not sure.
i have tried while statment 1 condition , works, don't see why not working multiple
your or
statement evaluates true
.
if task == 'e'
, task != 'd'
, , while
loop evaluates true
, making loop continue indefinitely.
change like:
task = " " while task not in "ed": # stuff
Comments
Post a Comment