1. How long will it take to compute the chance of doubling 1 million dollars one dollar at a time?
Can someone help me with this
Using this code how can I use the stopwatch module to filll out this table
Use the stopwatch module to estimate how long your program runs.
stake - initial amount you start with
goal - the amount you want to end with (you will either lose it all or make your goal)
trials - the number of times you want to run the experiment - run the experiment 100 times to get a more accurate estimate of the probability. Do any empirical analysis using the doubling method. Start with the stake = 500 and goal 1000 and continue to double until the stake = 1000000.
![TN
TN/ TN/2
500
1000
2000
4000
8000](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe2ec270a-5ed4-4aed-8cc7-15f8560395d2%2Fd8ae765c-7f57-442c-8e28-69cae26cae49%2Fm8s0f4_processed.png&w=3840&q=75)
![See the implementation of gambler.py . How long will it take to compute the chance of doubling 1 million dollars one dollar at a time?
2 gambler.py - C:\Users\ducep\OneDrive - The University of Montana\CSCI 151 Online\Module12\gambler.py (3.9.6)
File Edit Format Run Options Window Help
import stdio
import sys |
import random
def main():
= int (sys.argv[1])
= int (sys.argv[2])
int (sys.argv[3])
stake
goal
trials
wins
= 0
for t in range(0,trials):
cash = stake
while (cash > 0 and cash < goal):
if (random.random() < 0.5):
cash += 1
else:
cash
1
if (cash
stdio.writeln(str(wins) +
goal): wins += 1
==
wins of
+ str(trials) )
if
main
': main()
name
Ln: 2 Col: 11](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe2ec270a-5ed4-4aed-8cc7-15f8560395d2%2Fd8ae765c-7f57-442c-8e28-69cae26cae49%2Foez5var_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
So how long in seconds will it tak to compute 5000 dollars and then one milllion dollars
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)