-
-
Save anonymous/47f21c9af208834278d2 to your computer and use it in GitHub Desktop.
daily budget
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 | |
daily_budget = 250 | |
for x in range(games_to_play): | |
if daily_budget < 250: | |
break | |
winnings -= 250 # Gotta pay to play. | |
daily_budget -= 250 | |
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 | |
daily_budget += 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