Page 1 of 1

7. Write a Python script which estimates the probability that when rolling a pair of standard, 6-sided dice, the outcome

Posted: Mon May 02, 2022 11:39 am
by answerhappygod
7. Write a Python script which estimates the probability that
when rolling a pair of standard, 6-sided dice, the outcome is that
both dice individually have a face value less than some integer k.
Your code should print the estimated probability for every integer
k satisfying 1 ≤k ≤6. For k = 3, the exact (theoretical) result is
4 36 ≈0.111. Exact results differ for other integers k satisfying 1
≤k ≤6. Hint: estimate the probability by simulating N rolls of a
pair of dice. Count how many times both dice are less than k, then
divide this count by the total number of rolls. For a large value
of simulated rolls (eg: N = 106), this ratio should be very close
to the exact result. 2 marks for implementation of a script which
successfully estimates the six probabilities specified in the
question ie: for k = 1,2,...,6, displaying the re- sults to at
least three (3) decimal places. There are two quite different ways
to solve this problem: Monte Carlo simulation (as described in the
hint), and closed-form solutions for each of the