from pylab import * # Generates a boolean which is True with probability p. Use this # to generate patients in your Monte Carlo simulations. def flip(p): return (rand() < p) # Implement this monte carlo simulation def bloodtest(N, k, p, numtrials): return 0 # You might want to implement the formula you derived in the written assignment # to compare with your Monte Carlo simulations, but you don't have to. def bloodtest_exact(N, k, p): return 0 # This code calls bloodtest with the range of parameters that the homework asks for. numtrials = 3000 for N in [1000]: for p in [.01, .02, .04]: for k in [5, 10, 20]: print("N=%d, k=%d, p=%f" % (N, k, p), "\t--\t", bloodtest(N, k, p, numtrials)) print("")