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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
icon
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning