Skip to content

Instantly share code, notes, and snippets.

Created March 26, 2016 17:49
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 anonymous/b21185a2388399f94468 to your computer and use it in GitHub Desktop.
Save anonymous/b21185a2388399f94468 to your computer and use it in GitHub Desktop.
play over a year
from random import random
wallet = 0
games_to_play = 10
up, down = 0, 0
for y in range(365):
winnings = 0
for x in range(games_to_play):
winnings -= 250 # Gotta pay to play.
current_play = 0
cards_drawn = 0
while current_play <= 1:
random_number = round(random(), 1)
current_play += random_number
cards_drawn += 1
else:
winnings += cards_drawn * 100
if winnings > 0:
up += 1
else:
down += 1
wallet += winnings
print("Walked away up: {} days".format(up))
print("Walked away down: {} days".format(down))
print("Money in wallet at end ${}".format(wallet))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment