-
-
Notifications
You must be signed in to change notification settings - Fork 369
Open
Description
The plt render should be moved back one indentation, since you're really only interested in the final result and it saves you 5000 unnecessary renders
def monte_carlo(n):
results = 0
for i in range(n):
flip_result = coin_flip()
results = results + flip_result
prob_value = results/(i+1)
list1.append(prob_value)
plt.axhline(y=0.5, color ='r', linestyle='-')
plt.xlabel("Iterations")
plt.ylabel("Probability")
plt.plot(list1)
return results/n
Metadata
Metadata
Assignees
Labels
No labels