- 帖子
- 1
- 精华
- 0
- 积分
- 12
- 阅读权限
- 10
- 注册时间
- 2013-12-26
- 最后登录
- 2015-1-12
|
本帖最后由 roy 于 2013-12-26 15:56 编辑
学习中。。。
#coding UTF-8
from random import randint
Answer=randint(1,100)
totoal=10
left=0
num=0
time=0
print 'plese input the number you guess!!!'
while int(num) != Answer:
while time<=totoal :
num=int(input());
time+=1
left=totoal-time
if num>Answer:
print 'too big,you have['+str(left)+']times'
elif num<Answer:
print 'too small,you have['+str(left)+']times'
elif num==Answer:
print 'congratulations you get it!'
else:
print 'sorry,you have get more then 3 time,can not try again!'
|
|