• 猜谜小游戏


    #我们来写一个猜谜小游戏
    respond=input('你好呀,咱们来一个心有灵犀的小游戏吧!y or n ')
    if respond=='y':
        temp=input('好的!那我们开始,你猜一下我现在心中想的是那个数字,0-10之间的哦: ')
        time=3
        import random
        target=random.randint(0,10)
        while temp.isdigit() and (time>0):
            time=time-1
            guess=int(temp)
            if guess==target:
                print('我草,你也太厉害了吧,这都能猜到!')
                print('哼!猜到了也没有奖励啊哈哈哈')
                time=0
            else:
                if guess>target:
                    print('哎呀,猜大了')
                else:
                    print('哥,你猜小了')
                if time>0:
                    temp=input('重新输入:')
                else:
                    print('很抱歉你的机会用完了')               
    else:
        if respond=='n':
            print('好桑心!你都不跟我玩。')
        else:
            print('看不懂你输的神马!')
    print('游戏结束!')
  • 相关阅读:
    ABAP语法篇1 DATA新用法
    SAP RFC和BAPI
    SAP标准屏幕中字段描述增强
    HoloLens开发手记 - 使用Windows设备控制台 Using Windows Device Portal
    HoloLens开发手记
    HoloLens开发手记
    HoloLens开发手记
    HoloLens开发手记
    HoloLens开发手记
    HoloLens开发手记
  • 原文地址:https://www.cnblogs.com/themost/p/6358763.html
Copyright © 2020-2023  润新知