Я пытаюсь написать программу, которая включает цикл while
, в этом цикле у меня есть сообщение об ошибке, если что-то пойдет не так. Это вроде как:
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..
Проблема заключается в следующем: когда возникает ошибка после questionX
, программа переходит в начало. Он начинается с начала, а не с y
или z
. Но в x
нет проблем, поэтому программа должна начинать задавать вопросы от y
или z
, потому что проблема возникла в y
или z
.
Как я могу запустить программу из определенной точки, например, если есть ошибка только в вопросе y
, программа должна начинать задавать вопросы из y
или, если только в z
, программа должна начинаться с z
, а не начало-не x
.
Должен ли я использовать более одного цикла while
для этого или есть что-то, что заставляет это работать только в одном цикле?