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

python初接触

# guess LuckyNum
# 练习使用if_else语句
# 使用循环语句while
# 与、或、非 and、or、not

MyLuckNum = 66
NumInput = 0
GuessCount = 5
# while True:
while MyLuckNum != NumInput and GuessCount != 0:
NumInput = int(input("Please input number (0~100):"))
GuessCount -= 1
print("GuessCount=", GuessCount)

if NumInput <= 100:
if NumInput > MyLuckNum:
print("the real num is smaller")
elif NumInput < MyLuckNum:
print("the real num is bigger")
else:
print("Input Error!")
if GuessCount == 0 and MyLuckNum != NumInput:
print("time is over!")
else:
print("bingo!")

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