Question: a program to simulate a lottery game. (a)Ask the user to pick 4 unique numbers in the range of 1 to 10.Validate the numbers picked
a program to simulate a lottery game.
(a)Ask the user to pick 4 unique numbers in the range of 1 to 10.Validate the numbers picked by the user to ensure that they are not out of range and they are different.Ask the user to reenter if necessary.Sort and display the numbers picked by the user.
(b) Four balls will be randomly drawn from a pool of 10 balls. These balls are numbered 1 through 10. Simulate this process by using the sample function of the random module. Sort and display the numbers randomly picked by the computer.
(c)Compare the numbers picked by the user in part (a) and the numbers randomly picked by the computer in part (b) to see how many matches there are. Display the number of matches.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
