Guest User

Untitled

a guest
Dec 31st, 2022
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. import random
  2.  
  3. cuts = 0
  4. expectedValue = 0
  5. trials = 100000
  6.  
  7. for i in range (trials):
  8. startingValue = 100
  9. while startingValue > 0:
  10. startingValue = random.randint(0,startingValue)
  11. cuts += 1
  12.  
  13. expectedValue = cuts / trials
  14. print(expectedValue)
Advertisement
Add Comment
Please, Sign In to add comment