Skip to content

Instantly share code, notes, and snippets.

@abresas
Last active July 27, 2016 16:57
Show Gist options
  • Save abresas/3ae783d8b6fcce9754f9e08f62df88bf to your computer and use it in GitHub Desktop.
Save abresas/3ae783d8b6fcce9754f9e08f62df88bf to your computer and use it in GitHub Desktop.
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