Lottery Ticket Challange- Python Coding I have coded... import random #lists pick=[] rand_ticket=[] #variables #write outFile = open("lotteryTicket.txt","w") count=0 ticket="" while count


Lottery Ticket Challange- Python Coding


I have coded...


import random
#lists
pick=[]
rand_ticket=[]
#variables
#write
outFile = open("lotteryTicket.txt","w")
count=0
ticket=""
while count <>
ticket=(int(input("Enter a 1 digit number:")))
ticketList=pick.append(ticket)
count=count+1
outFile.write(str(ticket)+"\n")
outFile.close()
#print out the numbers they picked
print("Your ticket number is %s"%(pick))
#read the file
inFile = open("lotteryTicket.txt","r")
line = inFile.readline()
while (line):
line = inFile.readline()
count2=0
while count2<>
rand_ticket.append(random.randint(1, 9))
count2+=1
print("The winning ticket is %s"%(rand_ticket))
#compare numbers


complete this code to...




  • 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



One number match - free ticket


Two numbers match  - $2.00


Three numbers match - $10.00


Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here