第一个while循环

功能:猜测理想数字

代码如下:

numb = 66
print("猜测一个我想的数字,你有五次机会")
count = 1
input_numb = int(input("你猜什么"))
while count <= 5:
    if input_numb > numb:
        print("猜测的结果大了")
        a = True
    elif input_numb < numb:
        print("猜测的结果小了")
        a = True
    else:
        print("猜测结果正确")
        a = False
        break
    count = count + 1
    if count < 6:
        input_numb = int(input('再猜'))
if a:
    print('这都猜不出来')
else:
    print('你真聪明')

  

猜你喜欢

转载自www.cnblogs.com/wangpanger/p/10024308.html