我用randomint
函数编写了一个简单的数字猜测游戏。你知道吗
假设是我写的,看起来有点像这样:
import blah
import blah
print ("Hello, and welcome to the guesser")
Answer1 = (randomint(1,5))
Guess1 = int(input("Input a number 1-5")
if Guess1 == Answer1:
print ("You got lucky that time")
elif Guess1 < 6 and != Answer1:
#send back to guess again
elif Guess1 > 5:
print ("Invalid Number")
#send back to guess again
这可能是一个非常愚蠢的问题和初学者的东西,但是,有没有一个功能,可以满足我的需要和希望,送人回来猜一次数字?你知道吗
您正在搜索的内容称为编程中的循环。你知道吗
你可以这样做:
相关问题 更多 >
编程相关推荐