Question: Exercise 4 (2 points) Now, let's bring the pieces together and simulate a game. In this exercise, you will complete the given simulate game function

 Exercise 4 (2 points) Now, let's bring the pieces together andsimulate a game. In this exercise, you will complete the given simulategame function that simulates Monty Hall game 10000 times. The function has

Exercise 4 (2 points) Now, let's bring the pieces together and simulate a game. In this exercise, you will complete the given simulate game function that simulates Monty Hall game 10000 times. The function has 2 input arguments: . n: Number of doors k: Number of doors to be opened be Monty decision: Either Stay or Switch The function returns the number of wins for that particular decision num won: An integer count of the number of wins resulting from the decision . Hint: You have to think about how you will use the following functions - first_choice, initialize_game final_decision and monty_opens and what their input parameters should be to complete the exercise. In def simulate_game (n, k, decision): num won = 0 #variable to keep a track of the number of times the player won assert decision-- 'Switch' or decision "Stay"Check the parameter input for decision for i in range(10000) # YOUR CODE HERE return (num won) In [ ]: #### Test code #Case 1 num won - simulate_game (3,1, 'switch') prob_switch_won num_won/10000 assert prob_switch won

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!