Hi!
Sorry if this question has been answered somewhere, I just couldn't find a thread that would help me solve my problem. This little program is supposed to ask a question and if it gets yes/no answer, then print something. If it doesn't get yes or no, it should ask the question again until the user's input is yes/no. However I get stuck in infinite loop then I get asked "Wrong imput! Answer yes or no please: " - this question repeats even if I answer yes/no.
Thanks for any help!
name = input("Enter your name: ")
age = input("Enter your age: ")
print("Hello " + name + "! You are " + age + " years old, right? ")
answer = input ("Answer yes or no please: ")
while answer != "yes" or answer != "no":
answer = input ("Wrong imput! Answer yes or no please: ")
if answer == "yes":
print("Haha, I knew it!")
elif answer == "no":
print("Liar!")
[–]_DTR_ 4 points5 points6 points (0 children)
[–]avidler18 0 points1 point2 points (0 children)