Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import shuffle
- K=13
- def monte_carlo():
- mazzo = []
- for valore in range(1,K+1):
- mazzo += [valore]*4
- shuffle(mazzo)
- obiettivo = 1
- for carta in mazzo:
- if carta == obiettivo:
- obiettivo += 1
- if obiettivo == K+1:
- return True
- return False
- # codice eseguibile
- N = 100000
- goal = 0
- for _ in range(N):
- if monte_carlo():
- goal += 1
- print(goal / N)
Advertisement
Add Comment
Please, Sign In to add comment