Python Coding-(On Pycharm Community Edition) Create a mini-lottery with TEXT ticket. The user is going to save three numbers in a text file - those three numbers are from 1-9. In Python, create a program that reads those three numbers from the text file (ticket) Use a random number generator to draw three random numbers Compare the text ticket and the random numbers. If they match number (see below), output the prize The numbers can be in any order the random numbers can be duplicates, so be careful how you count! This work in a similar way to mini-assignment number 48 - but you DO NOT have to write to a text file. Have the user enter the numbers into the text file. Append the numbers read from the text file to a list read each number from the list and compare it to the randomly generated numbers you come up with One number match - free ticket Two numbers match - $2.00 Three numbers match - $10.00 -you don't have to complete bonus, it would be great if you could- BONUS 1: Let them win only if they match the number in the correct location : TICKET : 1, 2 ,3 RANDOM NUMBER : 2, 5, 3 This would yield only one match because it is the SAME number in the SAME placeholder location BONUS 2: Have the computer continue to draw random numbers until it matches the EXACT ticket. Count how many time this takes and output it to the user. Both the bonuses will come in handy for the FINAL PROJECTS
Python Coding-(On Pycharm Community Edition) Create a mini-lottery with TEXT ticket. The user is going to save three numbers in a text file - those three numbers are from 1-9. In Python, create a program that reads those three numbers from the text file (ticket) Use a random number generator to draw three random numbers Compare the text ticket and the random numbers. If they match number (see below), output the prize The numbers can be in any order the random numbers can be duplicates, so be careful how you count! This work in a similar way to mini-assignment number 48 - but you DO NOT have to write to a text file. Have the user enter the numbers into the text file. Append the numbers read from the text file to a list read each number from the list and compare it to the randomly generated numbers you come up with One number match - free ticket Two numbers match - $2.00 Three numbers match - $10.00 -you don't have to complete bonus, it would be great if you could- BONUS 1: Let them win only if they match the number in the correct location : TICKET : 1, 2 ,3 RANDOM NUMBER : 2, 5, 3 This would yield only one match because it is the SAME number in the SAME placeholder location BONUS 2: Have the computer continue to draw random numbers until it matches the EXACT ticket. Count how many time this takes and output it to the user. Both the bonuses will come in handy for the FINAL PROJECTS
Chapter8: Arrays
Section: Chapter Questions
Problem 4GZ
Related questions
Question
Python Coding-(On Pycharm Community Edition)
Create a mini-lottery with TEXT ticket.
- The user is going to save three numbers in a text file - those three numbers are from 1-9.
- In Python, create a program that reads those three numbers from the text file (ticket)
- Use a random number generator to draw three random numbers
- Compare the text ticket and the random numbers. If they match number (see below), output the prize
- The numbers can be in any order
- the random numbers can be duplicates, so be careful how you count!
- This work in a similar way to mini-assignment number 48 - but you DO NOT have to write to a text file. Have the user enter the numbers into the text file.
- Append the numbers read from the text file to a list
- read each number from the list and compare it to the randomly generated numbers you come up with
One number match - free ticket
Two numbers match - $2.00
Three numbers match - $10.00
-you don't have to complete bonus, it would be great if you could-
BONUS 1:
Let them win only if they match the number in the correct location :
TICKET : 1, 2 ,3
RANDOM NUMBER : 2, 5, 3
This would yield only one match because it is the SAME number in the SAME placeholder location
BONUS 2:
Have the computer continue to draw random numbers until it matches the EXACT ticket. Count how many time this takes and output it to the user.
Both the bonuses will come in handy for the FINAL PROJECTS
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,