Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created February 4, 2020 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/6ff27a98faf77049380b97b89f7f8cfd to your computer and use it in GitHub Desktop.
Save codecademydev/6ff27a98faf77049380b97b89f7f8cfd to your computer and use it in GitHub Desktop.
Codecademy export
import random
money = 100
# Write your game of chance functions here
# def coin_toss_game(coin_flip, bet):
# money_win = 100 + bet
# money_lost = 100 - bet
# flip_result = random.randint(1, 2)
# if coin_flip == "Heads" and flip_result == 1:
# print("You bet " + str(bet) + "€ on Heads, congrats you now have " +str(money_win) + "€!")
# else:
# print("You lost " + str(bet) + "€ on Heads, sorry." + " You now have " +str(money_lost) +"€ left!")
#
#
#
# print(coin_toss_game("Heads", 20))
def game_cho_han():
die_1 = random.randint(1,6)
die_2 = random.randint(1,6)
bet = (input("Please place your bet"))
odd_or_even = (input("Odd or Even?"))
if die_1 + die_2 == 3 or 5 and odd_or_even == "Odd":
return "Congrats! " + str(die_1 + die_2) +" is Odd so you win "+ str(bet) +"€!"
else:
return "Sorry, you lost " +str(bet) +"€8"
print(game_cho_han())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment