猫史档案馆


【Python作品分享】喵【教程贴】

用户:夜莺鸟的号角夜莺鸟的号角查看:0 回复:0 评论:0 创建时间:2019-12-19T20:05:46


【作品展示】

center_image

 

【作品介绍】

只是一个普通的喵

 

【作品源代码】

import random
money = int(1000)
a = ["苹果","桃子","香蕉"]
b = ["桃子","苹果","香蕉"]
c = ["香蕉","桃子","苹果"]
a1 = ""
b1 = ""
c1 = ""
l = 0 #轮数
while True:
    t = input("欢迎使用喵,按下1抽奖")
    if t == "1":
        money = money - 50
        l = l +1
        a1 = random.choice(a)
        b1 = random.choice(b)
        c1 = random.choice(c)
        print(a1,b1,c1)
        if a1 == b1 and a1 == c1:
            money = money + 100
            print("恭喜你,中奖了!")
            print("剩余钱数",money)
        else:
            print("剩余钱数", money)
    if money == 0:
        break
print("你玩了",l,"轮")

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页