猫史档案馆


【Python作品分享】欢迎来到我的世界【求助帖】

用户:RosangG99RosangG99查看:0 回复:1 评论:0 创建时间:2021-07-03T18:51:22


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

import random
import random as r


name = input('你的名字?')
greeting = ['欢迎欢迎', '祝您游戏愉快', '愿您有美好的一天']
print('Hello', name, random.choice(greeting))

def a():

    c = random.randint(0, 100)
    d = 0
    while True:
        b = int(input('请输入数字:'))
        d += 1
        if (b == c):
            print('猜对了')
            print('用了', d, '次!')
            break
        elif (b > c):
            print('大了')
        elif (b < c):
            print('小了')
        else:
            print('输入格式不正确')

a()

print('再来融合颜色吧,red=1,yellow=2,blue=3,请输入相应数字')
print('掌握三原色原理后可输入0退出')
color1 = int(input('请输入第一种颜色:'))
color2 = int(input('请输入第二种颜色:'))
while (color1 != 0 and color2 != 0):
    if (color1 == 1 and color2 == 2 or color1 == 2 and color2 == 1):
        print('橙色')
    elif (color1 == 2 and color2 == 3 or color1 == 3 and color2 == 2):
        print('绿色')
    elif (color1 == 1 and color2 == 3 or color1 == 3 and color2 == 1):
        print('紫色')
        break
    else :
        
        color=int(input('你最喜欢的颜色是什么'))
        print(name,'最喜欢',color,',已经存入档案,谢谢!')

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
wwwloadwwwload

真的”已“存入了档案

点赞0


评论