Вы можете выполнить нужный процесс, но не с помощью цикла while
, но можно сделать с помощью function
.Я переписал ваш код, чтобы получить желаемый результат.Попытайся.
def user(user_input_1='yes'):
if user_input_1 == 'yes':
print('Cont..')
# Do something
if checkcondition_1 == True:
# Do something
user_input_2 = input("input_2")
if user_input_2 == 'yes':
pass
# Do something
if user_input_2 == 'no':
pass
# Do something
else:
print("Going back")
user_input_1 = input("input_1") # These two lines are equavalent to your continue.
user(user_input_1)
if user_input_1 == 'no':
user_input_3 = input("input_3")
if user_input_3 == 'yes':
return None # this is equivalent to break.
if user_input_3 == 'no':
# I need help to go back to "User_Input_1 == 'yes'
#Go all the way back to "user_input_1" =='yes' condition.
#Is it possible to go back like that?
user() # Calling user() function with default value, which is user_input_1 = 'yes'.
user_input_1 = input("input_1")
checkcondition_1 = True
user(user_input_1)
Надеюсь, это может вам помочь.