I was trying to prompt input options and validate the input number. I separated into two different function, how can I make this into one function? Perhaps using return?
Code:
def again(option):
if option == 1:
print("one")
elif option == 2:
print("two")
else:
print("Invalid number !")
retry = int(input("Retry number: "))
if retry == 0:
print("return mainpage")
else:
while retry > 3 and retry < 0:
retry = int(input("Retry number: "))
if retry == 0:
print("return mainpage")
else:
again(retry)
def test():
option = int(input("Please enter your choices: "))
again(option)
test()