I am Mike and i am very new to python (2 days). I wanna ask the age of the user and then confirm that he has written the right age so after asking him what is your age I also ask is that correct?If the user says yeah it breaks the while loop and moves on, if the user says something other than yes or no it goes back and ask him yes or no again. - but how can I ask him his age again if the user says no (meaning that he has written the wrong age).
enter code here age = input("Please enter your age: ")
input("You are " + age + " years old. Correct?")
answer2 = None
while answer2 not in ("yes", "no"):
answer2 = input("Enter yes or no: ")
if answer2 == "yes":
break
elif answer2 == "no":
input("Oops.Something went wrong.""\nLets try again.")
else:
print("Please enter yes or no.")