2) scrooge.py Scrooge McDuck is letting you into his vault full of pennies, nickels, dimes and quarters. He will let you play the following game: you can pick 8 coins at random, and if they sum to at least a dollar, you win, and can keep your money! But if you lose, you don't get to keep the money, AND have to pay Scrooge a dollar. (Each coin you pick is equally likely to be a penny, nickel, dime, or quarter.) Your job: using a simulation, estimate 1. the probability that you win (meaning your coins sum to more than a dollar), and 2. if you play this game over and over, the average amount you will win (where the amount you win in a game could be negative). Here is a bit more direction: you should simulate 100,000 plays of this game. Each simulated play should involve picking 8 different random numbers - each one should be .01, .05, .10, or .25, with each value equally likely – which represent the 8 coins being chosen; these should be summed esch time. As you proceed through these 100,000 simulated plays, you should keep track of the number of simulations where you win: the probability of winning should be approximately equal to umber of winning simulations You should also keep track of the average amount of money you've won per game (again, losing a dollar counts as "winning" -1 dollars). total number of simulated games After the simulations are complete, print out your program's estimates for both. Specifications: your program must NOT ask the user for any input. print out an estimate of the probability that 8 values randomly chosen (independently and uniformly) from .01, .05, .10, and .25 sum to a value greater than or equal to 1. also print out an estimate of the average amount of winnings per game, where winnings are calculated by either the sum or –1, the latter when the sum of the 8 values is less than 1. • use 100,000 simulations with random numbers - no credit for theoretical solutions. Your answers should not be exactly the true probability/average, and you should not even get the same answers each time you run it. If this point isn't obvious, please ask for clarification!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
2) scrooge.py
Scrooge McDuck is letting you into his vault full of pennies, nickels, dimes and quarters. He will let you play the following
game: you can pick 8 coins at random, and if they sum to at least a dollar, you win, and can keep your money! But if you
lose, you don't get to keep the money, AND have to pay Scrooge a dollar. (Each coin you pick is equally likely to be a penny,
nickel, dime, or quarter.)
Your job: using a simulation, estimate
1. the probability that you win (meaning your coins sum to more than a dollar), and
2. if you play this game over and over, the average amount you will win (where the amount you win in a game could be
negative).
Here is a bit more direction: you should simulate 100,000 plays of this game. Each simulated play should involve picking 8
different random numbers - each one should be .01, .05, .10, or .25, with each value equally likely - which represent the 8
coins being chosen; these should be summed each time.
As you proceed through these 100,000 simulated plays, you should keep track of the number of simulations where you win:
number of winning simulations
total number of simulated games
the probability of winning should be approximately equal to
You should also keep track of
the average amount of money you've won per game (again, losing a dollar counts as "winning" -1 dollars).
After the simulations are complete, print out your program's estimates for both.
Specifications: your program must
NOT ask the user for any input.
print out an estimate of the probability that 8 values randomly chosen (independently and uniformly) from .01, .05, .10,
and .25 sum to a value greater than or equal to 1.
• also print out an estimate of the average amount of winnings per game, where winnings are calculated by either the
sum or -1, the latter when the sum of the 8 values is less than 1.
• use 100,000 simulations with random numbers – no credit for theoretical solutions. Your answers should
not be exactly the true probability/average, and you should not even get the same answers each time you run it. If
this point isn't obvious, please ask for clarification!
Transcribed Image Text:2) scrooge.py Scrooge McDuck is letting you into his vault full of pennies, nickels, dimes and quarters. He will let you play the following game: you can pick 8 coins at random, and if they sum to at least a dollar, you win, and can keep your money! But if you lose, you don't get to keep the money, AND have to pay Scrooge a dollar. (Each coin you pick is equally likely to be a penny, nickel, dime, or quarter.) Your job: using a simulation, estimate 1. the probability that you win (meaning your coins sum to more than a dollar), and 2. if you play this game over and over, the average amount you will win (where the amount you win in a game could be negative). Here is a bit more direction: you should simulate 100,000 plays of this game. Each simulated play should involve picking 8 different random numbers - each one should be .01, .05, .10, or .25, with each value equally likely - which represent the 8 coins being chosen; these should be summed each time. As you proceed through these 100,000 simulated plays, you should keep track of the number of simulations where you win: number of winning simulations total number of simulated games the probability of winning should be approximately equal to You should also keep track of the average amount of money you've won per game (again, losing a dollar counts as "winning" -1 dollars). After the simulations are complete, print out your program's estimates for both. Specifications: your program must NOT ask the user for any input. print out an estimate of the probability that 8 values randomly chosen (independently and uniformly) from .01, .05, .10, and .25 sum to a value greater than or equal to 1. • also print out an estimate of the average amount of winnings per game, where winnings are calculated by either the sum or -1, the latter when the sum of the 8 values is less than 1. • use 100,000 simulations with random numbers – no credit for theoretical solutions. Your answers should not be exactly the true probability/average, and you should not even get the same answers each time you run it. If this point isn't obvious, please ask for clarification!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Probability Problems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education