-
-
Save codecademydev/157a763814968943c3a983f200442674 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
money = 100 | |
#Write your game of chance functions here | |
def coin_flip(guess, bet): | |
if 2 >= guess >= 1.5 and random.randint(1, 2) >= 1.5: | |
return money + bet | |
elif 1 <= guess <= 1.5 and random.randint(1, 2) <= 1.5: | |
return money + bet | |
else: | |
return money - bet | |
print(coin_flip(1.5, 100)) | |
def Cho_Han(guess, bet): | |
if guess == "Even" and (random.randint(1, 6) + random.randint(1, 6)) % 2 == 0: | |
return money + bet | |
elif guess == "Odd" and (random.randint(1, 6) + random.randint(1, 6)) % 2 != 0: | |
return money + bet | |
else: | |
return money - bet | |
def Player_Pick_Random_Card_Game(bet1, bet2): | |
card1 = random.randint(1, 13) | |
card2 = random.randint(1, 13) | |
if card1 > card2: | |
total_money_player_1 = money + bet1 | |
total_money_player_2 = money - bet2 | |
elif card2 > card1: | |
total_money_player_1 = money - bet1 | |
total_money_player_2 = money + bet2 | |
elif card1 == card2: | |
total_money_player_1 = 0 | |
total_money_player_2 = 0 | |
return total_money_player_1 | |
return total_money_player_2 | |
print(Player_Pick_Random_Card_Game(32, 76)) | |
#Call your game of chance functions here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment