0
python if/else命令完全不起作用。Python忽略if/else命令?
import time
import os
import sys
def zelphaMain():
def zelphaMain_Credits():
print("Coding:")
print("John Antonio Anselmo")
print("")
print("")
print(">>Back")
def zelphaMain_CreditsInput_Options():
zelphaMain_CreditsInput = input(">> ")
if zelphaMain_CreditsInput == ("back") or ("Back"):
os.system('cls')
zelphaMain()
else:
print("What you have entered is not a valid command")
zelphaMain_CreditsInput_Options()
zelphaMain_CreditsInput_Options()
def zelphaMain_Game():
print("*")
time.sleep(1)
print("*")
time.sleep(1)
print("*")
time.sleep(1)
os.system('cls')
time.sleep(1)
print("Zelpha808")
time.sleep(1)
print("")
print("Booting...")
time.sleep(8)
os.system('cls')
def zelphaMain_Menu():
print("Main Menu")
print("")
print("")
print("Welcome to Zelpha808")
print("")
print("")
print(">>Start")
print(">>Credits")
print("")
zelphaMain_MenuInput = input(">> ")
if zelphaMain_MenuInput == ("Credits") or ("credits"):
zelphaMain_Credits()
else:
exit()
zelphaMain_Menu()
zelphaMain()
下来,如果zelphaMain_MenuInput == ("Credits") or ("credits"):
当我运行该程序,并获得了游戏的主菜单,不管什么,我输入,前进到zelphaMain_Credits()。在信用中,不管我输入什么,它就像我输入“返回”一样。我不知道发生了什么,如果你们中有人感到困惑或需要澄清,我很乐意添加更多细节。
你可以抛弃那些括号 –
你也可以小写变量,并有一个比较 –
哇......我觉得自己很蠢,感谢的人,完全工作:P –