#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 点,如果我的大脑没电了,我想知道如何解决它
添加回答
举报
0/150
提交
取消