Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How solve this problem in Python. 5. Smith is in jail and has 3 dollars; he can get out on bail if he has 8
How solve this problem in Python. 5. Smith is in jail and has 3 dollars; he can get out on bail if he has 8 dollars. A guard agrees to make a series of bets with him. If Smith bets A dollars, he wins A dollars if he bets $2 dollars he wins 2 dollars. The probability of win the bet is 0.5. Consider he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy). For instance at the beginning he bets all the money and if he wins, he gets 6 dollars in total, then he bets again, but now he just needs to bet 2 dollars to get 8 a) Write a python program that simulates this situation Hint: to define if a player wins or lose the bet generate a random number between 0 and 1. If the generated value is less or equal then 0.50 the player wins if is greater the player loses the bet. Hint: Use g=np.random.rand() to generate a random number between 0 and 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started