我尝试用python编写一个“让你自己冒险”的故事,并且尝试使用多个“if”循环。然而,程序一直在说“语法错误”。有人能告诉我为什么会发生这种情况,并说明一个可能的解决方案吗
a = eval(input("Enter 0 to go on the ladder, and 1 to try out you new pair of plunger boots: "))
if a == 1:
print("You put on the boots and climb on the side of the ship. You put one foot forward, then the next, then you try to take a step.")
time.sleep(10)
print("However, the boots won't budge.")
time.sleep(2)
print("MISSION FAIL")
time.sleep(1)
else:
print("You climb up the ladder.")
time.sleep(2)
print("You see a guard at the top armed with an automatic rifle.")
time.sleep(4)
print("You can use the grenade in your pocket, or you can take him out with your pack of C4")
time.sleep(5)
b = eval(input("Enter 0 for grenade, 1 for the pack of C4: ")
if b == 0:
print("You throw the grenade up.")
time.sleep(3)
print("You hear a smack, and you see the grenade coming back down at you.")
time.sleep(4)
print("MISSION FAIL")
print("Mental note: These guards are known for their fast reflexes.")
time.sleep(3.5)
b=eval(…)行缺少“)”
应该是
而且它是
因此,语法错误
相关问题 更多 >
编程相关推荐