0
How to restart my program I want it so if the user makes a wrong choice it goes back to the first question. (PYTHON 3) pls help
If more details needed ask in comments section.
9 Respostas
+ 2
while True:
answer = input("test:")
if answer == "hello":
print("hello people")
break
0
Something like this?
if (wrong):
main()
0
Yes but I don't know how to define wrong I'm new
0
I put wrong into the program and it said "name error wrong not defined" it is a name error.
0
Yeah it's pseudo code, (wrong) is the result from a condition, like:
if input() != answer:
main()
I think we can help if you share your code
0
Ok let me pull it up real quick it is not that long.
0
print ("hello world")
answer = input ("test ")
if answer == ("hello"):
answer = input (" hello people ")
0
When I put hello it says hello people but if I type a random word it stops the program but I wanted it to restart if I make a mistake.
0
Brilliant thank you Nikolai Ivanov