Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- cuts = 0
- expectedValue = 0
- trials = 100000
- for i in range (trials):
- startingValue = 100
- while startingValue > 0:
- startingValue = random.randint(0,startingValue)
- cuts += 1
- expectedValue = cuts / trials
- print(expectedValue)
Advertisement
Add Comment
Please, Sign In to add comment