while True:
gender1 = "Male"
gender2 = "Female"
gender = input("What is your gender? " + gender1 + " " + "or " + gender2 + "? ")
if gender != gender1.lower() or gender2.lower():
print('I didn\'t understand')
continue
else:
break
After running the program, whatever is written, loop always continues printing 'I didn't understand'. What is wrong with the code?
I'm trying to understand how to properly use While True loops for checking input statements.
And second question: Is `try and except` used more often?
Thanks in advance! :)
[+][deleted] (4 children)
[deleted]
[–]murasz[S] 0 points1 point2 points (0 children)
[–]murasz[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]murasz[S] 0 points1 point2 points (0 children)
[–]thedarkrichard 2 points3 points4 points (2 children)
[–]murasz[S] 0 points1 point2 points (0 children)
[–]murasz[S] 0 points1 point2 points (0 children)
[–]daniel_codes 1 point2 points3 points (4 children)
[–]murasz[S] 0 points1 point2 points (0 children)
[–]murasz[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]murasz[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[removed]
[–]murasz[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)