码迷,mamicode.com
首页 > 其他好文 > 详细

3 数字猜谜游戏

时间:2019-12-29 20:21:37      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:http   style   alt   number   code   mamicode   put   NPU   ber   

# 数字猜谜游戏
number = 7
guess = -1
print("数字猜谜游戏!")
while guess != number:
    guess = int(input("请输入你猜的数字:"))
    if guess == number:
        print("你猜对了!")
        print("游戏结束")
    elif guess < number:
        print("猜的数字小了")
    elif guess > number:
        print("猜的数字大了")

结果:

技术图片

3 数字猜谜游戏

标签:http   style   alt   number   code   mamicode   put   NPU   ber   

原文地址:https://www.cnblogs.com/CPU-Easy/p/12116169.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!