猜数字作业

"""
# _*_coding:utf-8_*_
Name:猜数字.py
Date:19-1-14.py
Author:li
connecton:[email protected]
Desc:
"""

i = 0
import random
while i <5:
    b = int(input('请输入数字:'))
    a = random.randint(1, 100)
    print(a)
    if a==b:
        print('恭喜中奖')
        break
    if a>b:
        print('too small')
        i +=1
    if a<b:
        print('too big')
        i+=1
else:
    print('您已经使用5次机会了')

猜你喜欢

转载自blog.csdn.net/weixin_43323669/article/details/86479523