Write a program that randomly generates a lottery between 100 and 999 (random.randint(100, 999)), prompts the user to enter a number in the same range, and determines whether the user wins according to the following rule: (1) If the user input matches the lottery in exact order, print "the award is $10,000". E.g., lottery = 123, input = 123 (2) If the user input matches the lottery, but in wrong order, print "the award is $6,000". E.g., lottery = 123, input = 321 (3) If two digits in the user input matches a digit in the lottery, print "the award is $3,000". E.g., lottery = 123, input = 612 (4) If one digit in the user input matches a digit in the lottery, print "the award is $1,000". E.g., lottery = 123, input = 289 (5) If none of the digits is matched, print "thank you".
-scripting language
Write a program that randomly generates a lottery between 100 and 999 (random.randint(100, 999)), prompts the user to enter a number in the same range, and determines whether the user wins according to the following rule:
(1) If the user input matches the lottery in exact order, print "the award is $10,000". E.g., lottery = 123, input = 123
(2) If the user input matches the lottery, but in wrong order, print "the award is $6,000". E.g., lottery = 123, input = 321
(3) If two digits in the user input matches a digit in the lottery, print "the award is $3,000". E.g., lottery = 123, input = 612
(4) If one digit in the user input matches a digit in the lottery, print "the award is $1,000". E.g., lottery = 123, input = 289
(5) If none of the digits is matched, print "thank you".
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images