Last active
July 27, 2016 16:57
-
-
Save abresas/3ae783d8b6fcce9754f9e08f62df88bf to your computer and use it in GitHub Desktop.
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 | |
from sys import exit | |
value = 100 | |
steps = 0 | |
while True: | |
steps += 1 | |
if random() < 0.51: | |
value *= 0.9 | |
else: | |
value *= 1.1 | |
print(value) | |
if value <= 1: | |
print("run out of money after", steps, "steps") | |
exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment