Question: How do u write a python code for this? In the gambler's ruin problem, a gambler with a finite amount of money, say $10, plays
In the gambler's ruin problem, a gambler with a finite amount of money, say $10, plays a fair game against an opponent (such as a casino) with infinite money. On each turn, the gambler has a 50-50 chance of winning $1 or losing $1. But even though the game is fair, the gambler will inevitably go broke eventually. Your task is to write a program that calculates how many games it takes the gambler to go broke. Example run: How much money do you have? 10 It took 521 turns to go broke. For 5 points extra credit, have the program display a plot of the gambler's money over time: 200 300 400 S00 100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
