I´m new to Stackoverflow and to Python. As my first own program I wrote a text game where you enter (a) or (b) and decide this way which decision your character makes. Its working out quite well, but I have one problem. If the user enters, for example, "a" on the first decision, "b" on the second decision, but something invalid on the third, the next valid input will trigger the first decision again instead of the third. I tried to make a short version which portrays my problem. Any help is appreciated.
def test():
while True:
input_zero = input("1. > ")
if input_zero == "a":
print("a")
input_a = input("2. > ")
if input_a == "a":
print("a, a")
break
elif input_a == "b":
print("a, b")
break
else:
print("Invalid input.")
elif input_zero == "b":
print("b")
input_b = input("2. > ")
if input_b == "a":
print("b, a")
break
elif input_b == "b":
print("b, b")
break
else:
print("Invalid input.")
else:
print("Invalid input.")
test()