-
-
Save anonymous/182cd8a25820e340fdca to your computer and use it in GitHub Desktop.
Winnings after ten games
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 | |
winnings = 0 | |
games_to_play = 10 | |
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 | |
print("Winnings ${}".format(winnings)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment