【发布时间】:2012-07-04 23:37:32
【问题描述】:
好的,我正在制作轮盘游戏。旋转器落在的随机数称为“数字”。这是一个非常基本和简单的代码,但它似乎不适用于我。 目前,您要么选择一个特定的数字,要么选择 1 - 18。我尝试了许多不同的方法,但仍然没有运气。这是我的代码。如果有人知道问题是什么,请告诉我。谢谢:
numbers = ['1', '2', '3'.......'35', '36']
figure = choice(numbers)
d = textinput("Pick bet", "")
if int(figure) > 18 and d == '1-18' or '1 - 18' or '1- 18' or '1 -18':
pu()
goto(100,100)
write("Loser", font = ("Comic Sans MS", 30, "bold"))
elif int(figure) < 19 and d == '1-18' or '1 - 18' or '1- 18' or '1 -18':
pu()
goto(10,100)
write("Well done", font = ("Comic Sans MS", 30, "bold"))
elif int(d) in range(36) and int(figure) == int(d):
pu()
goto(100,100)
write("Well done", font = ("Comic Sans MS", 30, "bold"))
elif int(d) in range(36) and int(figure) != int(d):
pu()
goto(100,100)
write("Loser", font = ("Comic Sans MS", 30, "bold"))
【问题讨论】:
标签: python random if-statement python-3.x int