为了账号安全,请及时绑定邮箱和手机立即绑定

我已经设置了一个 RNG 和一个继续按钮,但它不会在继续后更新结果

我已经设置了一个 RNG 和一个继续按钮,但它不会在继续后更新结果

泛舟湖上清波郎朗 2021-06-22 05:34:54
#Setting up RNGloop = "y"while loop == "y" or loop == "yes":    from random import randint    dice = (randint(1,10))    dice2 = (randint(1,10))    roll = (dice + dice2)    win = 3    loss = 2    cash = 20    if roll == 3 or roll == 7 or roll == 11 or roll == 17:        cash += (win)    else:        cash -= (loss)    #Starting game    print("""Welcome to, Gambling for School!    You have $20 and must earn as much money as possible    If you roll a 3, 7, 11, or 17, you will win $3 but any other number takes $2    You have a 20% of winning""")    x = input("Press ENTER to start.")    #Results    if roll == 11 or roll == 8 or roll == 18:        print("You rolled an " + str(roll) + "!")    else:        print("You rolled a " + str(roll) + "!")    print("")    print("Cash - $" + str(cash))    loop = input("Continue? (Y/N) ").lower()必须更改缩进以将其显示为代码当它运行时,我按回车键开始游戏,它正确地加减,但是当我选择继续时,它就像我从来没有输过钱或赚过钱一样。现在是凌晨 1 点,如果我的大脑没电了,我想知道如何解决它
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 96 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信