MONTY HALL LAB write this code in python and use # to answers questions - You are only allowed to use the following functions/methods: print(), range(), len(), sum(), max(), min(), and .append(). It is not mandatory to useall of these functions/methods. 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

MONTY HALL LAB

write this code in python and use # to answers questions - You are only allowed to use the following functions/methods: print(), range(), len(), sum(), max(), min(), and .append(). It is not mandatory to useall of these functions/methods.

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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Program on Numbers
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education