有人可以幫助我,我是編程新手,無法弄清楚爲什麼不能運行?Python令人困惑,需要幫助
import time
import os
lives = 3
def start():
global lives
if lives < 1:
print("GAME OVER")
quit()
print("You wake up in a well.")
print("Do you climb out or get help?")
well = input("Help or Climb? ")
if well == "H" or "h" or "help" or "Help":
print("You get your phone out.")
time.sleep(2)
print("There's no charge left.")
print(" " * 3)
lives = lives - 1
print("You have", lives, "lives left.")
time.sleep(3)
os.system("cls")
start()
elif well == "C" or "c" or "climb" or "Climb":
print("You start climbing up the walls of the well.")
time.sleep(3)
print("You are close, but you lose your footing and are blinded by the sunlight,")
footing = input("Move your foot to the left or right?")
if footing == "L" or "l" or "left" or "Left":
print("You miss the step and fall.")
lives = lives - 1
start()
start()
當您嘗試運行它時,它會告訴您什麼? – mgilson
'well ==「H」或「h」或「help」或「Help」是錯誤的。 –
這樣的東西:'如果well ==「H」或「h」或「help」或「Help」:'不會起作用,那麼您需要'如果在[「H」,「h」 ,「help」,「Help」]:'或'如果well.lower()[0] =='h':'或類似。 –