Lecture Notes on 13 Oct 2017 Pepys Problem: Which is more probable at least one six in six throws of a fair die or at least two sixes in twelve throws of a fair die. import random def is_successful (num_throws, sixes): num_six = 0 throw = 0 while (throw < num_throws): if (random.randint(1,6) == 6): num_six += 1 throw += 1 return (num_six >= sixes) def main (): # input number of trials from the user num_trials = int (input ('Enter number of trials: ')) # scenario 1: 6 throws of a die trial = 0 num_success = 0 while (trial < num_trials): if (is_successful (6, 1)): num_success += 1 trial += 1 print ('Scenario 1: ', num_success, '/', num_trials) # scenario 2: 12 throws of a die trial = 0 num_success = 0 while (trial < num_trials): if (is_successful (12, 2)): num_success += 1 trial += 1 print ('Scenario 2: ', num_success, '/', num_trials) main()