0

I'm new to python and learning, when i get to the final print line, how do i get it to return to line 1? I cannot see a 'goto' or similar. Thanks.

ANSWER1 = input ("Do you own an Xbox?")
    if ANSWER1 == "Yes":
     print ("Nice!")
    elif ANSWER1 == "No":
     print ("Too bad...")
    else:
     print ("It is a simple yes or no question try again.")
  • 2
    Use a loop, like `while True: ...` – Barmar Feb 10 '22 at 21:05
  • SO is not a tutoring service, you're expected to learn the language basics elsewhere. – Barmar Feb 10 '22 at 21:05
  • Modern languages haven't supported goto in a *long* time. Pretty much any modern language is going to rely on loops to get you the same functionality. – Nick Bailey Feb 10 '22 at 21:07
  • Use a while-loop. See all the existing Q&A on this, like [Asking the user for input until they give a valid response](https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response), and [the others: *\[python\] while-loop input score:5*](https://stackoverflow.com/search?q=%5Bpython%5D+while-loop+input+score%3A5) – smci Feb 10 '22 at 21:08
  • Ok, many thanks, I'll use a while loop. – twood888 Feb 10 '22 at 21:09

0 Answers0