Advertisement
Guest User

Untitled

a guest
Mar 19th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import random
  2. from fractions import gcd
  3.  
  4.  
  5. wins = 0
  6. times = 0
  7.  
  8. for i in range(10000):
  9. times += 1
  10.  
  11. x = random.randint(0, 1000)
  12. win = True
  13. for i in range(1000):
  14. if random.randint(0, 1000) == x:
  15. win = False
  16. break
  17. if win:
  18. wins += 1
  19.  
  20.  
  21. print wins / gcd(wins, times), "/", times / gcd(wins, times)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement