|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import random
times = 3
secret = random.randint(1,10)
guess = 0
print("不妨猜一下我现在心里想的是什么数字:"end="")
while(guess != secret) and (times > 0):
temp = input()
while not temp.isdigit():
temp = input('抱歉,你的输入有误,请输入一个数字:')
guess = int(temp)
times = times -1
if guess == secret:
print('wocao,你是我小甲鱼心里的蛔虫吗')
print('he,猜中了也没有奖励')
else:
if guess> secret:
print('大了大了')
else:
print('小了小了')
if times > 0:
print('再试一次吧')
else:
print('机会用完了')
print('游戏结束')
end=" " 这个有什么用,运行的话,会变红报错
本帖最后由 orino 于 2018-1-26 11:12 编辑
这个是结束符号,意思是在输出后不换行,如果end=" "表示以空格结束输出,如果end=""表示空结束, end=","逗号结束
|
|