Question: answer each line if code please Assume that the starting funds are $10,000 and we always wager 1$100 per game. We solve this problem in
Assume that the starting funds are $10,000 and we always wager 1$100 per game. We solve this problem in the folowing steps: - Step 0. Import library and set seed - Step 1, Define a function which returns True if the plyyer wins and False otherwise. - Step 2. Define a function which simulates playing the game a given number of times; it uses the function in Step 1 and adjusts the funds avallable depending it the player wins or loses. Function returns the amount of funds remaining after playing the given number of times and the number of times the player winsloses. - Step 3. Write code to call the function in Step 2 for 5 games. Output the funds remaining after 5 games and number of winsloses. - Step 4. Modify the code in Step 4 to do this simulation (of playing 5 games) 100 times. Output the average of the funds remaining after 5 games and the probability of wining 8 losing: eutput the expected value for this simulation. The results you get in Step 4 do NOT match our theoretical expected value of losing $2 per game. You are asked to make modification(s) to your code in Step 4 so that your discrete expected value is close to the theoretical value. In [1]: Faport randen Iibrary aad set seed Step 3. Now assume that we wager $100 per game, we start with 1510,000 . Write code to call the function in Step 2 to simulate playing 5 games. Print cut the funds 8 number of wins and losses remaining after these 5 games. Step 4. Now simulate playing 5 games 100 times and print out the average amount of funds remaining when you play 5 games. Print out the discrete probubility of winning or losing. As betore the discrote probability of winning is just the total number of wins over all simulations divided by the total number of games simulated. in 17 Now this amount of losing over \$B per game doesn't agree with our theonebical expected value of losing about i\$2 per game. What do we need to do to get a better approuination? Modity the necessary statement(s) in your program and perform another simulation to get around losing $2 per game
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
