Monty Hall Problem

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Monty Hall Problem – Coding Lab

In this lab, you will write a code that simulates the Monty Hall Game Show. The
game host gives the participant the choice of selecting one of three doors. Two
doors has a goat behind them and one door has a prize. The set of choices are
randomized each round. The participant needs to select the door with the prize
behind it. When the participant selects a door, the game host reveals a door with a
goat behind it. The game host opens a door (different from the one selected by the
participant) that has a goat behind it. The participant is then given the option to
change their choice.

When you run your code, the code would display a message prompting the user to
input their door choice, labelled as 1, 2, and 3. Then the code will display a door
number (different from the one the user picked) with a goat behind it and ask the
user if they would like to change their choice. The code then displays a message on
whether the user guessed the correct door. The game then restarts for another
round, displaying the first message that was shown at the beginning of code. The
game should run for a total of 5 rounds and at the end, the probability of the user
winning is displayed as the final message. The section of the program that runs the
game should be coded as a function.

You will need to learn how to use the input function as well as importing the
random package. random has different built in functions that generate randomized
values which will assist you in randomizing the choices for the doors. You will
need to include comments and briefly explain (at the end of your code) how you
would maximize your chances of winning. Would 5 rounds be enough to sample
the probability of winning or would you need to run the simulation several times?
How would you automate it if you need to run it several times?

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Fundamentals of Input and Output Performance
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr