Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import choice
- numtests = 1000000
- def test():
- bacs = 1
- time = 0
- while time <> 30:
- newbacs = 0
- for b in range(bacs):
- newbacs += choice((0,1,2,2))
- bacs = newbacs
- time += 10
- if bacs == 6: return True
- numsuccess = 0
- for i in range(numtests):
- if test(): numsuccess = numsuccess + 1
- print float(numsuccess)/numtests
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement