Oct-20-2017, 03:55 PM
import random red=[1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36] black=[2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35] balance=5000 print("Welcome to Chad's Online Roulette game!") print("Your starting balance is $50, or 5000 tokens.") while True: betamount=int(input("How many tokens would you like to bet?")) betcolor=int(input("Bet on red (enter 1), black (enter 2), or green (enter 3)?")) roll=random.randint(-1,36) greenwin=betamount*35 redblackwin=betamount*2 balance=balance-betamount if betcolor is 1: if roll in red: balance=balance+redblackwin print("The roll was a " + str(roll) +".") print("Your balance is now "+ str(balance)+" tokens.") else: print("The roll was a " + str(roll) +".") print("Your balance is now "+ str(balance)+" tokens.") elif betcolor is 2: if roll in black: balance=balance+redblackwin print("The roll was a " + str(roll) +".") print("Your balance is now "+ str(balance)+" tokens.") else: print("The roll was a " + str(roll) +".") print("Your balance is now "+ str(balance)+" tokens.") elif betcolor is 3: if roll is 0 or roll is -1: balance=balance+greenwin print("The roll was a 0.") print("Your balance is now "+ str(balance)+" tokens.") else: print("The roll was a " + str(roll) +".") print("Your balance is now "+ str(balance)+" tokens.") if balance is 0: print("You have ran out of money. Better luck next time!") break
Reply