python pyscripter定义错误
你好,我的名字是卢克,我的水果机代码有一个define错误,单词skull被定义了,但它说它不是,我不明白为什么。如果你能帮助我,那就太好了,谢谢你花时间来解决这个问题python pyscripter定义错误,python,undefined,pyscripter,Python,Undefined,Pyscripter,你好,我的名字是卢克,我的水果机代码有一个define错误,单词skull被定义了,但它说它不是,我不明白为什么。如果你能帮助我,那就太好了,谢谢你花时间来解决这个问题 import random symbols = ["cherry","bell","lemon","orange","star","skull"] credit=100 x=1 while x == 1: yn = input ("ready to play (y or n)") if yn == "y": pr
import random
symbols = ["cherry","bell","lemon","orange","star","skull"]
credit=100
x=1
while x == 1:
yn = input ("ready to play (y or n)")
if yn == "y":
print("You have this much credits:")
print (credit)
print ("ok lets start roleing")
credit = credit - 10
else:
print ("why are you here then? go away")
exit()
wheel1 = random.choice(symbols)
wheel2 = random.choice(symbols)
wheel3 = random.choice(symbols)
print (wheel1 + "-" + wheel2 + "-" + wheel3 + "-")
if wheel1 == wheel2 == wheel3 == skull:
print ("you got 3 skulls you lose all of your money,thank you for playing")
exit()
elif wheel1 == wheel2 == wheel3 == star:
print ("################################")
print ("# #")
print ("# BIG JACK POT #")
print ("# #")
print ("################################")
credit = credit + 1000
print("YOU GOT THE BIG JACKPOT AND GOT 1000")
elif wheel1 == wheel2 == wheel3 == cherry:
print ("################################")
print ("# #")
print ("# jack pot #")
print ("# #")
print ("################################")
credit = credit + 500
print("you got the small jackpot and got 500")
elif wheel1 == wheel2 == wheel3:
print ("################################")
print ("# #")
print ("# small jack pot #")
print ("# #")
print ("################################")
print ("you got the small jack pot and got 250")
credit = credit + 250
elif wheel1 == wheel2 == skull:
print ("you got 2 skulls - 10 credits")
credit = credit - 10
elif wheel1 == wheel3 == skull:
print ("you got 2 skulls - 10 credits")
credit = credit - 10
elif wheel2 == wheel3 == skull:
print ("you got 2 skulls - 10 credits")
credit = credit - 10
elif wheel1 == wheel2 :
print ("mini prize you got 10 credits")
credit = credit + 10
elif wheel1 == wheel3 :
print ("mini prize you got 10 credits")
credit = credit + 10
elif wheel2 == wheel3 :
print ("mini prize you got 10 credits")
credit = credit + 10
else:
print("you got nothing,better luck next time")
但是您没有在任何地方定义
skull
——您在列表中有一个由这些字符组成的字符串,但其中没有任何部分构成定义。或者在它出现的任何地方加引号(就像你在符号列表中做的那样),或者在顶部附近加上skull=“skull”
来定义它的名字。好的,我很抱歉给你带来不便,我问了我的老师,她刚刚说python坏了。无论如何,谢谢你的帮助,我希望你有一个愉快的一天