Simulate the monty hall problem

Assignment Help Python Programming
Reference no: EM132355259

Question

In this problem, we will be writing pieces to simulate the Monty hall problem. Monty Hall was the host of "Let's Make a Deal" in the 1960's and 70's.

The problem can be summarized by the following:

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you,

"Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

The host must always open a door that was not picked by the contestant.

The host must always open a door to reveal a goat and never the car.

The host must always offer the chance to switch between the originally chosen door and the remaining closed door.

The typical problem is for 3 doors but we can easily extend it to any number of doors. The simulation for this problem can be designed in different ways. However, we will focus our design using Python's dictionary and string objects along with some basic concepts of probability theory.

Caveat for the whole notebook - This problem specifically deals with probabilities and simulations. Wherever required, we have implemented 99.7% confidence intervals for checking your answers. Do keep in mind that there is a probability (very small) that your answer lies beyond this interval. In such a scenario, you might want to re-run the test cell.

Exercise 0 Complete the function initialize_game() which has 1 input argument:

n: The total number of doors

The function will place a car behind one of the n doors randomly and uniformly (following Uniform Distribution).

The function returns a dictionary with:

keys as strings in the pattern 'Door x', where 1≤x≤n

1≤x≤n, and

values as either the string 'Goat' or the string 'Car'.

There can only be one 'Car' in the dictionary. All the other values shall be 'Goat'.

Example: For n = 5, 'Car' can be behind any door from 'Door 1' to 'Door 5'. In this case, 'Car' is behind 'Door 2', the function should return:

{'Door 1': 'Goat', 'Door 2': 'Car', 'Door 3': 'Goat', 'Door 4': 'Goat', 'Door 5': 'Goat'}

Reference no: EM132355259

Questions Cloud

Is a security engineer supposed to be a psychologist then : Psychology of the user is a key factor when it comes to system security. Is a security engineer supposed to be a psychologist then?
Create a behavioral state machine for each complex classes : Create a behavioral state machine for each of the complex classes in the class diagram. Perform a CRUDE analysis to show the interactivity of the objects.
Evaluate progress on a regular basis : Identify the problem solving process step with which it is associated: Evaluate progress on a regular basis.
Explaining in which environment business operates : How can I do a Business memorandum explaining in which environment business operates?
Simulate the monty hall problem : In this problem, we will be writing pieces to simulate the Monty hall problem. Monty Hall was the host of "Let's Make a Deal" in the 1960's and 70's.
Would a reverse logistics or closed-loop supply chain : Would a reverse logistics or closed-loop supply chain be a better problem solving approach in terms of CSR?
Write analysis of five policy case in field of energy policy : Write a 600 word paper on Analysis of Five Policy Cases in the Field of Energy Policy. Paper should be in APA format. No plagarism. Include references.
United states-based businesses : What are 3 social trends faced by many United States-based businesses? What are 3 economic trends faced by many United States-based businesses?
Identify two misconceptions : Identify two misconceptions about innovation in the workplace.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd