-
-
Save codecademydev/2673948cf8c40f64c7fc693a690bc452 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): | |
money = 100 | |
flip = random.randint(1, 2) | |
1 == "Heads" | |
2 == "Tails" | |
win = "You win " + str(bet * 2) + "!" + "You now have " + str((bet *2) + money) + "." | |
lose = "Sorry, wrong guess. You lose " + str(bet * 2) + "." + " You now have " + str(money - (bet * 2)) + "." | |
if flip == guess: | |
return win | |
if flip != guess: | |
return lose | |
#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