Question: In [ 8 5 ] : import math import random import numpy as n p from scipy.stats import binom from scipy.stats import norm from random
In : import math
import random
import numpy as
from scipy.stats import binom
from scipy.stats import norm
from random import shuffle
successcount
numsimulations
for in rangenumsimulations:
boxes random. sample
foundcount
for in range :
currentbox boxes
if currentbox :
foundcount
else:
for in range :
currentbox boxes currentbox
if currentbox :
found count
break
if foundcount :
successcount
break
probofsuccess successcount numsimulations
print prob of success
Code gives assertion error, what can be fixed? Thank you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
