Write a Python script that calculates the top prize amount in a lottery.  Ask the user to enter the largest possible jackpot amount as an integer (10,000 - 1,000,000). Check the input to make sure it is between the two numbers and ask to re-input if it is not.  Use the randint function to randomly generate the jackpot amount.  The randint range will be from 1,000 to the user input value.  Use the randint function with a range of 1 to 20, to get the number of people that win the lottery.  Calculate the prize amount for each person by dividing the lottery prize (1st random number) by the number of people that win (2nd random number). Display the total prize amount, the number of people that win, and the prize amount for each person. Decimal points *must* line up in the output. Keep looping until the user enters 0 as the prize amount.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a Python script that calculates the top prize amount in a lottery. 

  1. Ask the user to enter the largest possible jackpot amount as an integer (10,000 - 1,000,000). Check the input to make sure it is between the two numbers and ask to re-input if it is not. 
  2. Use the randint function to randomly generate the jackpot amount.  The randint range will be from 1,000 to the user input value. 
  3. Use the randint function with a range of 1 to 20, to get the number of people that win the lottery. 
  4. Calculate the prize amount for each person by dividing the lottery prize (1st random number) by the number of people that win (2nd random number).
  5. Display the total prize amount, the number of people that win, and the prize amount for each person. Decimal points *must* line up in the output.
  6. Keep looping until the user enters 0 as the prize amount.

Required: 

  • Create the following functions. 
    • One function is the main() function (mainline logic for the program).
    • One function is the XX_prize_per_winner() function. Pass the number of winners and the jackpot amount, return the amount per winner.

Create a custom module XX_LAB52.py to store the XX_prize_per_winner() function. (XX are your initials)

Requirements: 

  1. Variable names should give an indication of what they are used for.
  2. Variables and functions should have different name.
  3. Use global constants if required.
  4. Program must not use break or exit to end.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY