fork(3) download
  1. import random
  2. letter=random.randrange(30)
  3. if letter>25: letter="wild"
  4. else: letter=chr(97+letter)
  5. yes=random.randrange(6)
  6. if yes<1: yes="maybe"
  7. elif yes<3: yes="probably"
  8. else: yes="yes"
  9. print(letter," ",yes)
  10.  
  11. experiments=4
  12. stake=2.5
  13. win=round(36**4*stake)
  14. c=-.5
  15. print()
  16. print("start gambling with:",0)
  17. for j in range(0,experiments):
  18. for i in range(0,36**4):
  19. r=random.randrange(37**4)
  20. if r==0:
  21. i-=36**4
  22. c+=1
  23. print(c,"x",win)
  24. c-=1
  25. print("how much have you won?")
  26. print("better luck next time!")
Success #stdin #stdout 4.77s 12368KB
stdin
Standard input is empty
stdout
l   probably

start gambling with: 0
how much have you won?
-0.5 x 4199040
0.5 x 4199040
1.5 x 4199040
how much have you won?
how much have you won?
0.5 x 4199040
how much have you won?
better luck next time!