ANMI 2 3 4 5 6 8 15 16 17 18 19 20 21 22 23 24 10 11 12 def count_matches (my_list, lottery_list): 13 14 34 35 36 37 38 39 40 41 42 43 44 45 51 52 53 54 55 56 57 58 59 60 def generate_lottery_numbers(): Generates a list of 5 random integers between 1 and 42, inclusive, with no duplicates. 298821 Returns: 25 26 27 28 29 30 31 32 def play_lottery_once(): 33 65 66 67 list: A list of lottery numbers 68 # Type your code here. pass "*" Takes two lists of equal length representing the player's chosen number list and the generated lottery list and returns the number of matches between my list and lottery_list. For example, count_matches ([10, 6, 20, 5, 7], [30, 6, 7, 40, 5]) will return 3, since both lists contain 5, 6, 7. Parameters: my_list (list): Your lottery numbers. lottery list (list): A list of the winning numbers. Returns: 46 47 def sim_many_plays (n): 48 49 50 int: The number of matching integers # Type your code here. pass *** Uses generate_lottery_numbers() and count_matches () to return the reward gained in playing the lottery one time. The lottery costs $1 to enter. The game award is determined according to the Table derived from data published by the state of Georgia. (If a player wins "one free play", we simply calculate this as winning $1). Returns: int: The total dollar amount gained by playing the game # Type your code here. pass """ Simulates a single person playing the lottery n times, to determine their overall winnings at the end of each simulated lottery Parameters: n (int): The number of times the person plays the lottery. 61 if name == "__main__": 62 63 64 Returns: list: The total winnings after each of the n lotterys # Type your code here. pass seed = int(input('Enter a seed for the simulation: ')) random.seed (seed) # Simulate 1000 plays by one person and plot the winnings. winnings = sim_many_plays (1000) plotwinsAcrossManyPlays (winnings)

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

I need help solving this question ?

1 def generate_lottery_numbers():
*** Generates a list of 5 random integers between 1 and 42,
inclusive, with no duplicates.
-234567891912345678928212222425252728298123458789¥12457898123科55拓望能卵卵乳酸發科5%的品
10
20
30
12 def count_matches (my_list, lottery_list):
40
50
Returns:
60
61 if
list: A list of lottery numbers
# Type your code here.
co
pass
""" Takes two lists of equal length representing the player's chosen
number list and the generated lottery list and returns the number of
between my_list and lottery_list.
matches
For example, count_matches ([10, 6, 20, 5, 7], [30, 6, 7, 40, 5])
will return 3, since both lists contain 5, 6, 7.
Parameters:
my_list (list): Your lottery numbers.
lottery list (list): A list of the winning numbers.
32 def play_lottery_once():
Returns:
int: The number of matching integers
# Type your code here.
pass
*** Uses generate_lottery_numbers () and count_matches () to return the
reward gained in playing the lottery one time. The lottery costs $1
to enter. The game award is determined according to the Table
derived from data published by the state of Georgia.
(If a player wins "one free play", we simply calculate this as
winning $1).
47 def sim_many_plays (n):
Returns:
int: The total dollar amount gained by playing the game
# Type your code here.
pass
""" Simulates a single person playing the lottery n times, to
determine their overall winnings at the end of each simulated lottery
Parameters:
n (int): The number of times the person plays the lottery.
Returns:
list: The total winnings after each of the n lotterys
pass
# Type your code here.
_name__ == "__main_":
seed = int(input('Enter a seed for the simulation: '))
random.seed (seed)
winnings = sim_many_plays(1000)
# Simulate 1000 plays by one person and plot the winnings.
plotwinsAcrossManyPlays (winnings)
Transcribed Image Text:1 def generate_lottery_numbers(): *** Generates a list of 5 random integers between 1 and 42, inclusive, with no duplicates. -234567891912345678928212222425252728298123458789¥12457898123科55拓望能卵卵乳酸發科5%的品 10 20 30 12 def count_matches (my_list, lottery_list): 40 50 Returns: 60 61 if list: A list of lottery numbers # Type your code here. co pass """ Takes two lists of equal length representing the player's chosen number list and the generated lottery list and returns the number of between my_list and lottery_list. matches For example, count_matches ([10, 6, 20, 5, 7], [30, 6, 7, 40, 5]) will return 3, since both lists contain 5, 6, 7. Parameters: my_list (list): Your lottery numbers. lottery list (list): A list of the winning numbers. 32 def play_lottery_once(): Returns: int: The number of matching integers # Type your code here. pass *** Uses generate_lottery_numbers () and count_matches () to return the reward gained in playing the lottery one time. The lottery costs $1 to enter. The game award is determined according to the Table derived from data published by the state of Georgia. (If a player wins "one free play", we simply calculate this as winning $1). 47 def sim_many_plays (n): Returns: int: The total dollar amount gained by playing the game # Type your code here. pass """ Simulates a single person playing the lottery n times, to determine their overall winnings at the end of each simulated lottery Parameters: n (int): The number of times the person plays the lottery. Returns: list: The total winnings after each of the n lotterys pass # Type your code here. _name__ == "__main_": seed = int(input('Enter a seed for the simulation: ')) random.seed (seed) winnings = sim_many_plays(1000) # Simulate 1000 plays by one person and plot the winnings. plotwinsAcrossManyPlays (winnings)
The Wealth Gap Problem
The state of Georgia uses the revenue generated from its lottery to fund college scholarships for its residents. These scholarships include
the HOPE Scholarship Program (which gives out Zell Miller Scholarships, HOPE Scholarships, and HOPE Grants). Each of these
scholarships is merit-based, meaning they are awarded based on academic achievement rather than financial need. The minimum GPA for
a HOPE Scholarship is 3.0 and the minimum for a Zell Miller Scholarship is 3.7. Students must also complete a number of advanced
classes and achieve over a certain SAT score [2].
Higher-income students are more likely to receive these scholarships in Georgia. On a surface level, the redistribution system appears fair.
However, students are competing for these scholarships on an uneven playing field. Students from higher income families have the
resources to receive tutoring for standardized tests, and potentially achieve higher GPAS, whereas lower income families are less likely to
enroll their children in supplementary lessons and extracurricular activities [4]. Additionally, poverty-related stressors at home and lack of
resources in poorer school districts lead to an educational disadvantage [8]. With merit-based scholarships, the lower income students who
need the financial aid are less able to break the poverty cycle by going to college [3]. The HOPE Scholarship Program has historically
awarded far fewer scholarships to lower income students compared to their middle and high income counterparts [9].
Figure: Distribution of Georgia scholarships in 2013 (Source: Inside Higher Ed, 2016).
Middle- &
High-Income
52%
% of In-state Undergraduates
by Income, Fall 2013
20
17.5
Low-Income
48%
Part whit
Catata from 2001 to 2013 from the Connecticut Lottery, Adam Osmond
Alvin Chung/Vax
% of HOPE Scholars
by Income, Fall 2013
Lottery Players
Low income populations play the lottery more, but receive scholarships less often than their high-income counterparts. In big jackpot
lotteries such as Powerball, participation is generally level across income levels. However, lottery games with comparatively small jackpots
drawn on an hourly or daily basis tend to draw players from lower income households [5]. Lottery outlets are often clustered in
neighborhoods with large minority populations (especially Hispanic neighborhoods) [10], suggesting significant participation within these
groups; yet a study on merit-based scholarships shows there are significant inequities among scholarship recipients. Even in high poverty
areas, white students are awarded more non-need, merit scholarships than Black and Hispanic students [7]. From this, we hypothesize that
the lottery system redistributes wealth from lower income, minority families to higher income families in the form of scholarships.
Figure: Scatter plot of minority percentages vs. lottery wins (Source: Vox, 2016).
Towns with higher minority populations play the lottery
more often
Middle- &
High-Income
58%
Vox
Reward
play_lottery_once()
Low-income
42%
Georgia's Fantasy 5 Lottery
In this assignment, you will be creating a lottery simulation for Fantasy 5, one of the lottery games in Georgia, to explore and evaluate the
lottery's profitability and effect it has on low income populations.
How it works
No. of Matches $1
A player enters the Fantasy 5 drawing by selecting five numbers from 1 to 42, with no duplicates. The player pays $1 to enter their chosen
numbers in a drawing. The lottery draws five numbers at random, and the reward is determined by how many of the player's numbers
match the drawn set. These numbers do not need to match in the same order.
Table: Fantasy 5 Rewards. The reward values were based on the average rewards in June 2018 [6].
Middle-& High
Income
79%
2
5
No prize One free play $11 $198 $212,535
3
% of Zell Miller Scholars
by Income, Fall 2013
4
Low-income
21%
References
1. "About Us." Georgia Lottery, www.galottery.com/en-us/about-us.html
2. "Eligibility for the HOPE Scholarship | Georgia Student Finance Commission." Georgia Student Finance Commission, Georgia Student
Finance Commission, HTML
3. "Break the Cycle of Poverty: Stand Together Foundation, 2 Dec. 2020, standtogetherfoundation.org
4. Caucutt, Elizabeth. "The Real Reason Why Poor Kids Perform Worse in School - and in Life." The Washington Post, WP Company, 1
Mar. 2019, HTML
5. Chang, Alvin. "4 Ways the Lottery Preys on the Poor." Vox, 13 Jan. 2016, HTML
6. "Georgia (GA) Fantasy 5 Prizes and Odds for Sat, Jun 30, 2018. Lottery Post HTML
7. Heller, Donald E., and Patricia Marin. "State merit scholarship programs and racial inequality. Civil Rights Project at Harvard University
(2004).
8. Isaacs, Julia B. "Starting School at a Disadvantage: The School Readiness of Poor Children. The Social Genome Project, Mar. 2012,
PDF
9. Seltzer, Rick. "HOPE for Whom?" Inside Higher Ed, 16 Sept. 2016, HTML
Checkpoint A
Implement these functions from the template following the description (specification) in their docstring:
• generate_lottery_numbers()
• count_matches ()
10. Wiggins, Lyna, et al. "A Geospatial Statistical Analysis of the Density of Lottery Outlets within Ethnically Concentrated Neighborhoods."
Journal of Community Psychology, vol. 38, no. 4, 6 Apr. 2010, pp. 486-496, HTML
11. Wilde, Cathy. "People in Poor Neighborhoods Are Twice as Likely to Have Gambling Problems, Study Finds." University at Buffalo, 3
Jan. 2014, HTML
• Use Python Tutor to do incremental development, focusing on one function at a time in isolation
.
• Invent some of your own intermediate output, to get feedback while in develop mode
• Submit your work to get feedback from unit tests
• sim_many_plays ()
By default, this project does not generate any interesting printed output. So, you should use one of these strategies in your work:
Transcribed Image Text:The Wealth Gap Problem The state of Georgia uses the revenue generated from its lottery to fund college scholarships for its residents. These scholarships include the HOPE Scholarship Program (which gives out Zell Miller Scholarships, HOPE Scholarships, and HOPE Grants). Each of these scholarships is merit-based, meaning they are awarded based on academic achievement rather than financial need. The minimum GPA for a HOPE Scholarship is 3.0 and the minimum for a Zell Miller Scholarship is 3.7. Students must also complete a number of advanced classes and achieve over a certain SAT score [2]. Higher-income students are more likely to receive these scholarships in Georgia. On a surface level, the redistribution system appears fair. However, students are competing for these scholarships on an uneven playing field. Students from higher income families have the resources to receive tutoring for standardized tests, and potentially achieve higher GPAS, whereas lower income families are less likely to enroll their children in supplementary lessons and extracurricular activities [4]. Additionally, poverty-related stressors at home and lack of resources in poorer school districts lead to an educational disadvantage [8]. With merit-based scholarships, the lower income students who need the financial aid are less able to break the poverty cycle by going to college [3]. The HOPE Scholarship Program has historically awarded far fewer scholarships to lower income students compared to their middle and high income counterparts [9]. Figure: Distribution of Georgia scholarships in 2013 (Source: Inside Higher Ed, 2016). Middle- & High-Income 52% % of In-state Undergraduates by Income, Fall 2013 20 17.5 Low-Income 48% Part whit Catata from 2001 to 2013 from the Connecticut Lottery, Adam Osmond Alvin Chung/Vax % of HOPE Scholars by Income, Fall 2013 Lottery Players Low income populations play the lottery more, but receive scholarships less often than their high-income counterparts. In big jackpot lotteries such as Powerball, participation is generally level across income levels. However, lottery games with comparatively small jackpots drawn on an hourly or daily basis tend to draw players from lower income households [5]. Lottery outlets are often clustered in neighborhoods with large minority populations (especially Hispanic neighborhoods) [10], suggesting significant participation within these groups; yet a study on merit-based scholarships shows there are significant inequities among scholarship recipients. Even in high poverty areas, white students are awarded more non-need, merit scholarships than Black and Hispanic students [7]. From this, we hypothesize that the lottery system redistributes wealth from lower income, minority families to higher income families in the form of scholarships. Figure: Scatter plot of minority percentages vs. lottery wins (Source: Vox, 2016). Towns with higher minority populations play the lottery more often Middle- & High-Income 58% Vox Reward play_lottery_once() Low-income 42% Georgia's Fantasy 5 Lottery In this assignment, you will be creating a lottery simulation for Fantasy 5, one of the lottery games in Georgia, to explore and evaluate the lottery's profitability and effect it has on low income populations. How it works No. of Matches $1 A player enters the Fantasy 5 drawing by selecting five numbers from 1 to 42, with no duplicates. The player pays $1 to enter their chosen numbers in a drawing. The lottery draws five numbers at random, and the reward is determined by how many of the player's numbers match the drawn set. These numbers do not need to match in the same order. Table: Fantasy 5 Rewards. The reward values were based on the average rewards in June 2018 [6]. Middle-& High Income 79% 2 5 No prize One free play $11 $198 $212,535 3 % of Zell Miller Scholars by Income, Fall 2013 4 Low-income 21% References 1. "About Us." Georgia Lottery, www.galottery.com/en-us/about-us.html 2. "Eligibility for the HOPE Scholarship | Georgia Student Finance Commission." Georgia Student Finance Commission, Georgia Student Finance Commission, HTML 3. "Break the Cycle of Poverty: Stand Together Foundation, 2 Dec. 2020, standtogetherfoundation.org 4. Caucutt, Elizabeth. "The Real Reason Why Poor Kids Perform Worse in School - and in Life." The Washington Post, WP Company, 1 Mar. 2019, HTML 5. Chang, Alvin. "4 Ways the Lottery Preys on the Poor." Vox, 13 Jan. 2016, HTML 6. "Georgia (GA) Fantasy 5 Prizes and Odds for Sat, Jun 30, 2018. Lottery Post HTML 7. Heller, Donald E., and Patricia Marin. "State merit scholarship programs and racial inequality. Civil Rights Project at Harvard University (2004). 8. Isaacs, Julia B. "Starting School at a Disadvantage: The School Readiness of Poor Children. The Social Genome Project, Mar. 2012, PDF 9. Seltzer, Rick. "HOPE for Whom?" Inside Higher Ed, 16 Sept. 2016, HTML Checkpoint A Implement these functions from the template following the description (specification) in their docstring: • generate_lottery_numbers() • count_matches () 10. Wiggins, Lyna, et al. "A Geospatial Statistical Analysis of the Density of Lottery Outlets within Ethnically Concentrated Neighborhoods." Journal of Community Psychology, vol. 38, no. 4, 6 Apr. 2010, pp. 486-496, HTML 11. Wilde, Cathy. "People in Poor Neighborhoods Are Twice as Likely to Have Gambling Problems, Study Finds." University at Buffalo, 3 Jan. 2014, HTML • Use Python Tutor to do incremental development, focusing on one function at a time in isolation . • Invent some of your own intermediate output, to get feedback while in develop mode • Submit your work to get feedback from unit tests • sim_many_plays () By default, this project does not generate any interesting printed output. So, you should use one of these strategies in your work:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Operations of Linked List
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