李雄飞
Published on 2017-09-02 11:31 in 暂未分类

试用博客园编辑器

 
 1 # guess LuckyNum
 2 # 练习使用if_else语句
 3 # 使用循环语句while
 4 # 与、或、非 and、or、not
 5 
 6 MyLuckNum = 66
 7 NumInput = 0
 8 GuessCount = 5
 9 # while True:
10 while MyLuckNum != NumInput and GuessCount != 0:
11     NumInput = int(input("Please input number (0~100):"))
12     GuessCount -= 1
13     print("GuessCount=", GuessCount)
14 
15     if NumInput <= 100:
16         if NumInput > MyLuckNum:
17             print("the real num is smaller")
18         elif NumInput < MyLuckNum:
19             print("the real num is bigger")
20     else:
21         print("Input Error!")
22 if GuessCount == 0 and MyLuckNum != NumInput:
23     print("time is over!")
24 else:
25     print("bingo!")
GusessNumProgram

尝试

使用博客园自带编辑器上传文章2018-01-23 15:51:15

 


哈哈

 

博客园

 

 

posted @ 2018-01-23 15:54  李雄飞  阅读(233)  评论(0编辑  收藏  举报