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...






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


Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here