Using the code below, how to simulate the screenshot below?
Also, provide flowchart.
import numpy as np
import pandas_montecarlo
org_deck=['AS','AH','AC','AD','2S','2H','2C','2D','3S','3H','3C','3D','4S',
'4H','4C','4D','5S','5H','5C','5D','6S','6H','6C','6D','7S','7H','7C',
'7D','8S','8H','8C','8D','9S','9H','9C','9D','TS','TH','TC','TD','JS',
'JH','JC','JD','QS','QH','QC','QD','KS','KH','KC','KD']
def MonteCarlo(n):
res=0
for i in range (n):
deck = copy.deepcopy(org_deck)
random.shuffle(deck)
if kingking(deck):res+=1
print (res/n * 100)
def kingking (deck):
for i in range(len(deck)-1):
if deck=='K' and deck[i+1][1]=='K':
return true
Monte Carlo Simulation Probability 35. n Probability 30+ 10 30% 25+ 100 28% 20+ 1000 22.8% 15+ 10000 21.75% 10+ 100000 21.752% 5+ 1000000 21.8103% log(n 10000000 21.73852% 1 3 4 5 6 7
Using the code below, how to simulate the screenshot below? Also, provide flowchart. import numpy as np import pandas_mo
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am