Question
Introduction to Python You are expected to write a code which redeems lottery tickets based on the following instructions: The program starts by asking the
Introduction to Python
You are expected to write a code which redeems lottery tickets based on the following instructions: The program starts by asking the user how many tickets they have in order to increase efficacy and redeem the users tickets in a single run. Each lottery ticket has 4 rows that contain 4 digit numbers. After the user enters how many tickets they own, the program goes ticket by ticket, and asks the 4 digits number in each one by one. If the number in any given row can be divided by 7, the user earns $10. If it cant be divided by 7, then user gets $1 for that row. So for any given ticket, user can earn 4$ in the worst case scenario, and $40 in the best case scenario. (Given that each ticket has 4 rows) As said, program should execute operations row by row, meaning after a user enters the 4 digit code on the ticket, the program calculates the prize for that row and stores it, which will be printed at the very end of the program. The program should also print out the information of rows and ticket numbers each time a new ticket or row is introduced (Look at the sample run, youll understand what this clause means) Assume that user always enters a positive integer for the amount of tickets and 4 digit positive integers for each row, you dont need to check if the inputs are valid. To get the indentation of Ticket #NUMBER and Row#NUMBER as shown in the sample run, use the trailing space command.
How many tickets do you have?: 3 Ticket # 1 Row # 1 What is your four digit code for this row?: 6741 Row # 2 What is your four digit code for this row?: 1111 Row # 3 What is your four digit code for this row?: 6453 Row # 4 What is your four digit code for this row?: 9009 Ticket # 2 Row # 1 What is your four digit code for this row?: 3724 Row # 2 What is your four digit code for this row?: 1141 Row # 3 What is your four digit code for this row?: 8764 Row # 4 What is your four digit code for this row?: 6720 Ticket # 3 Row # 1 What is your four digit code for this row?: 1542 Row # 2 What is your four digit code for this row?: 2576 Row # 3 What is your four digit code for this row?: 7642 Row # 4 What is your four digit code for this row?: 1734 You won 75 dollars
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started