试用博客园编辑器
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-2315:51:15
哈哈
安科网
相关推荐
shuhaojie 2020-11-02
lerdor 2020-10-14
cakecc00 2020-09-27
iammjun 2020-09-23
MarkDownHere 2020-09-16
usepython 2020-07-20
学习web前端 2020-07-18
longzhiwen 2020-07-15
老甘的可读区 2020-07-09
zhongzhiwei 2020-07-04
maoyongfan 2020-06-28
layloge 2020-06-26
Hesland 2020-06-14
佛系程序员J 2020-06-09
老甘的可读区 2020-06-07
Kingcxx 2020-06-04
James0 2020-06-01
xiongxu 2020-05-31
pythonclass 2020-05-30