I'm trying to write a program that include a while
loop, in this loop I have an error message if something goes wrong. It's kinda like this;
while True:
questionx = input("....")
if x =="SomethingWrongabout questionX":
print ("Something went wrong.")
continue
other codes...
questiony = input("....")
if y == "SomethingWrongabout questionY":
print ("Something went wrong.")
continue
other codes...
questionz = input("....")
if z == "SomethingWrongabout questionZ":
print ("Something went wrong.")
continue
other codes..
The problem is as follows: when an error occurs after questionX
, the program goes to beginning. It starts from the beginning, not from y
or z
. But at x
there is no problem, so that, the program should start asking questions from y
or z
because, the problem occurred at y
or z
.
How can I make the program start from a specific point, like if there is an error only at y
question, program must start asking questions from y
or if only at z
,program must start from z
, not beginning-not x
.
Should I use more than one while
loop for this or is there anything that makes this work only in one loop?