Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- money = 100
- #num = random.randint(1, 10)
- #Write your game of chance functions here
- def coin(call, bet):
- flip = random.randint(0,100)
- if flip >= 50:
- flip = "Heads"
- else:
- flip = "Tails"
- if call == flip:
- print("You Won! $"+str(bet))
- return bet
- else:
- print("You lost! $"+str(bet*-1))
- return bet*-1
- def cho(call, bet):
- dice1 = random.randint(1,6)
- dice2 = random.randint(1,6)
- sumdice = dice1+dice2
- if sumdice % 2 == 0:
- sumdice = "Even"
- else:
- sumdice = "Odd"
- if call == sumdice:
- print("CHO You won! $"+str(bet))
- return bet
- else:
- print("CHO You lost! $"+str(bet*-1))
- return bet*-1
- def cards(bet):
- pull = random.randint(1,14)
- pull2 = random.randint(1,14)
- if pull > pull2:
- print("You won! $"+str(bet))
- return bet
- elif pull2 > pull:
- print("You lost! $"+str(bet*-1))
- return bet*-1
- else:
- print("You tied! $0")
- return 0
- def roul(num, odd_even, range_1, bet):
- rando = random.randint(0, 37)
- print("The rolled number was "+str(rando))
- if rando >= 19:
- call = "High"
- else:
- call = "Low"
- if num == rando:
- print("You won with correct number! $"+str(bet*rando))
- return bet*rando
- elif range_1 == call:
- print("You won with range call! $"+str(bet))
- return bet
- elif num % 2 == 0 and odd_even == "Even":
- print("You won with Even call! $"+str(bet))
- return bet
- elif num % 2 != 0 and odd_even == "Odd":
- print("You won with Odd call! $"+str(bet))
- return bet
- else:
- print("You lost! $"+str(bet*-1))
- return bet
- #Call your game of chance functions here
- money += coin("Tails", 10)
- print("You made $"+str(money))
- money+=cho("Even", 20)
- print("You made $"+str(money))
- money+=cards(25)
- print("You made $"+str(money))
- money+=roul(15, "Even", "Low", 50)
- print("You made $"+str(money))
- #print(coin("Heads", 10)) #test for coin function, IS WORKING
- #print(cho("Even", 10)) #test for cho-Han function, IS WORKING
- #print(cards(10)) #test for cards function, is WORKING
- #print(roul(15, "Even", "Low", 10))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement