Question: Exercise 0 (2 points) Complete the function initialize_game () which has 1 input argument: n: The total number of doors The function will place a

 Exercise 0 (2 points) Complete the function initialize_game () which has

Exercise 0 (2 points) 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 3 x 5n, 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 ' t Door 5 . In this case, .Car' is behind EDoor., the function should return: 'Door 1: 'Goat', 'Door 2': 'Car", 'Door 3'; 'Goat', 'Door 4': 'Goat', 'Door 5' Goat' def nitialize-game (n): In [ ]: from random import randrange # YOUR CODE HERE for i in range(n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!