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
7. Write a Python script which estimates the probability that when rolling a pair of standard, 6-sided dice, the outcome
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
7. Write a Python script which estimates the probability that when rolling a pair of standard, 6-sided dice, the outcome
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!