Menu()函数一直说它是语法错误,我不知道如何解决。
global celebritydoggame
def Menu():
print ("Play,Quit Or Cards")
choise = input(">?")
if input == "Play" or "play":
Deck()
elif input == "Quit" or "quit":
print("Thank You")
quit()
elif input == "Cards" or "cards":
cards()
def cards():
myfile = ("dogs.txt","r")
def Deck():
print("How many cards do you want to play with in the game?")
print("The amount of cards must be between 4-30, also you must choose a even number.")
num = input(">?")
if input == int >30:
print ("error")
elif input == int (4) <30:
print ("ok the number of cards in play are"("int"))
elif input == int(num(4> int(num(30<
print("Total of Cards must be over 4, under 30 and a even number"))
Menu()
答案 0 :(得分:1)
在Deck
函数的结尾处有一个多余的括号。
此外,您的条件似乎不对:例如重写
if input == "Play" or "play":
为
if input == "Play" or input == "play"
UPD:您实际上在Dock
函数中有很多错误,几乎每个print
和if
都是错误的。我强烈建议您学习python语法。
答案 1 :(得分:1)
由于Deck()
函数的最后两行而发生了。
elif input == int(num(4> int(num(30<
print("Total of Cards must be over 4, under 30 and a even number"))
在这里,您没有正确关闭括号。
if
函数中的Deck()
语句也有问题。
if input == int >30:
input
是一个从用户那里获取价值的功能。
几乎每个if
和elif
语句中都有一个错误。
即使在Menu()
函数中,它也应该是这样的:
if input == "Play" or input == "play":
Deck()