Python raw_input如何只使一个输入成为可能

时间:2017-05-03 06:41:48

标签: python

我是python的新手,我还在做的第一个项目是一种游戏,你可以掷骰子和类似的东西,所以它几乎是一个骰子模拟器。

在用户真正开始游戏之前,我已经让程序问他们这样的问题; "键入'开始'在键盘上开始游戏,我正在使用raw_input

问题在于: - 我想只输入'开始'可写,如果写了别的东西,游戏就不会开始。我希望你理解我

from random import randint

min = 0
max = 6

start=raw_input("Welcome to the dice game, type 'start' on your keyboard to start the game:")
print("------------------------------------------------------------------------------------------")
name=raw_input("Okey, let's go! Before we can start you must type your name here: ")

print ("Hey %s, I guess we're ready to play!!" % name);
print("The whole game concept is basically to throw a dice and get as high number as possible!")
print("--------------------------------------------------------------------------------------------")
ja=raw_input("Would you like to throw the dice? Type 'yes' if so:")
print "Your number is:", randint(min, max)
print ("Thank you for playing!")

1 个答案:

答案 0 :(得分:1)

您只需要UITextField

if_else