Write a Python program that simulates N= 100000 rolls of two six-faced dice, counts the number...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Python program that simulates N= 100000 rolls of two six-faced dice, counts the number of times Nos of getting at least one 6 from the dice rolls, and finally output the estimated probability Nos/N of getting at least one 6 from a roll of the two dice together with the theoretical value. In your program, you should first generate a NumPy array of 2N uniform random integers ranging from 1 to 6 using the random module and then reshape this array to a two-dimensional 2xN array which represents the outcomes of N rolls of the two dice. Next, use this two-dimensional array with a vectorized algorithm to count the number of times of getting at least one 6 from the dice rolls. Write a Python program that simulates N= 100000 rolls of two six-faced dice, counts the number of times Nos of getting at least one 6 from the dice rolls, and finally output the estimated probability Nos/N of getting at least one 6 from a roll of the two dice together with the theoretical value. In your program, you should first generate a NumPy array of 2N uniform random integers ranging from 1 to 6 using the random module and then reshape this array to a two-dimensional 2xN array which represents the outcomes of N rolls of the two dice. Next, use this two-dimensional array with a vectorized algorithm to count the number of times of getting at least one 6 from the dice rolls.
Expert Answer:
Answer rating: 100% (QA)
Below is a Python program that simulates N100000 rolls of two sixfaced dice counts the number of tim... View the full answer
Related Book For
Posted Date:
Students also viewed these operating system questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
The electric field component of an electromagnetic wave traveling in a vacuum is given by Ey = Eo sin (kx - wt), where E = 300 V/m and k=107m. What are the frequency of the oscillations (in Hz) and...
-
Be able to explain how land policy shaped economic growth in the United States.
-
The following frequency distribution table lists the time (in minutes) that participants were late for an experimental session. Compute the sample mean, median, and mode for these data. Time (min)...
-
A stock is currently selling for $45 a share. What is the gain or loss on the following transactions? a. You take a long position and the stocks price declines to $41.50. b. You sell the stock short...
-
Refer to the information in Exercise 22-12. Assume that each of the companys divisions has a required rate of return of 7%. Compute residual income for each division. Data From Exercise 22-12 A food...
-
The Skyline Motel opened for business on May 1, 2014. Its trial balance before adjustment on May 31 is as follows. In addition to those accounts listed on the trial balance, the chart of accounts for...
-
Discuss the market concentration, competitiveness, and performance of the Australian grocery industry compared to other western countries. Identify the key stakeholders in the food supply chain, and...
-
The California treatment of pension and annuity income is generally the same as the Federal treatment. For example, California and Federal law are the same regarding all of the following except: A....
-
Understand how proliferated value-based payments are across the United States. Which is more prevalent today?
-
Present strategic recommendations for following business areas in Under Armour. 1) Direct to customer sales 2) Healthcare App (MapMyFitnesss)
-
Please create an IMC (integrated marketing communication) on Pratt&Whitney, mainly on in-person promotion/personal selling, events/meetings it attended(exhibition, military expo, exchange meetings...
-
Topics: Recursion and Merge-sort Problem Description Please make sure to read the document fully before starting! In this assignment, you will be tasked with writing methods that will solve some...
-
How can you implement a Java program named "AverageMethod" that defines a method titled "CalcAvg," capable of accepting two integer parameters (23 and 45) and calculating their average? Furthermore,...
-
A portfolio of annual coupon bonds is valued at $100. The modified duration of the bond portfolio, i.e., duration/(1+yield), is 8 years. Based on the past 2-year daily data, a risk management team...
-
The MIT Sloan School of Management is one of the leading business schools in the U.S. The following table contains the tuition data for the masters program in the Sloan School of Management. a. Use...
-
Based on the sample results in Data Set 18 of Appendix B, assume that human body temperatures are normally distributed with a mean of 36.4C and a standard deviation of 0.62C. If we define a fever to...
-
Refer to Data Set 13 in Appendix B. Construct a box plot for the weights of quarters. Compare the shape of the resulting box plot to the generic shapes. Based on the box plot, what do you conclude...
-
Refer to the Excel display below and answer the given questions. Construct the multiple regression equation that expresses earthquake magnitude in terms of latitude, longitude, and depth.
-
Which firms look best for someone wishing to buy stocks on margin?
-
Which firm looks best for someone planning to pay cash to buy 100 shares?
-
Examine all of the views available in the drop-down box menu (Snapshot, Performance, Portfolio, and Nuts and Bolts) to answer the following questions: a. Which fund has the best expense ratio? b....
Study smarter with the SolutionInn App