Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

What is electric dipole explain with example

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago

Question

Write down the circumstances in which you led.

Answered: 1 week ago