Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1 (1 point) Complete the function first_choice() which has 1 input argument: door_dict: A dictionary representing every numbered door and what that door is

image text in transcribed

image text in transcribed

Exercise 1 (1 point) Complete the function first_choice() which has 1 input argument: door_dict: A dictionary representing every numbered door and what that door is hiding (a dictionary similar to that returned by function intitialize game(n)) The goal here is to create a function where the player decides his/her first choice of door randomly and uniformly (following Uniform Distribution) The function returns int value indicating the door number selected by player depending on number of doors in door_dict In [3] def first_choice (door dict): # YOUR CODE HERE In [4]: # Test code door-dict {"Door 1': 'car', 'Door 2': 'Goat', 'Door 3': 'Goat'} door - first choice (door dict) assert type (door) is int, 'Expected int found .format (type (door)) # Test for 3 doors for i in range (10000) door- first-choice (door-dict) d[door11/10000 for i in range (3): assert 0.36 >= d[i] and d[i]>= 0.30, 'Function might not be choosing players first choice 1 # Testing for 5 Doors d [0]*5 door-dict {"Door 1': 'Car', 'Door 2': 'Goat', 'Door 3': 'Goat', 'Door 4': 'Goat', 'Door 5': 'C for i in range (10000) door = first choice(door dict) d[door -1]1/10000 for i in range (5): assert 0.25 > d[i] and d[] 0.15, 'Function might not be choosing players first choice 1 print("InPassed!")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions

Question

What steps should be taken to address any undesirable phenomena?

Answered: 1 week ago