关于下面的代码摘录,它要求再次“降落”火箭或“绕月”轨道的输入。如果您两次选择轨道运行,则当前代码中有一个死胡同,因为此后代码再也不会消失。我需要一个无限循环,以便如果游戏者进入“轨道”,则代码将循环回到choice5,并再次开始执行该序列,直到选择了“ land”或给出的任何其他答案导致游戏结束。除非有更好的方法来考虑这一点,否则代码运行良好,除非您两次回答“轨道”。如果我走的路正确,有什么想法吗?
choice4 = input("> ")
if "FIRE" in choice4:
print("\n")
print("You have entered the Moon's orbit. After one full orbit you can begin landing approach.")
print("You are half way 'round in the dark side of the Moon.")
print("......................")
print("You are approaching the conclusion of the orbit. Are you going to make another orbit or attempt to land?")
print("\n")
else:
print("\n")
print("That is not a valid choice, try again.")
dead()
choice5 = input("> ")
if "orbit" in choice5:
print("\n")
print("Going 'round again...")
print("You are half way 'round in the dark side of the Moon.")
print("......................")
print("You are approaching the conclusion of the orbit. FIRE thrusters to to land, or orbit again.")
print("\n")
elif "land" in choice5:
print("\n")
print("FIRE thrusters when ready to begin descent.")
else:
print("\n")
print("What are you thinking?")
dead()
choice6 = input("> ")
if "FIRE" in choice6: