-
-
Save anonymous/b21185a2388399f94468 to your computer and use it in GitHub Desktop.
play over a year
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
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