subject

Write 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 matthes there are. Display the number of matches.
The following is an example. You are asked to pick 4 unique numbers in the range of 1 to 10. Enter a number: 0 Must be in the range of 1 to 10 Enter a number: 11 Must be in the range of 1 to 10 Enter a number: 6 Enter a number: 10 Enter a number: 6 This number has already been picked Enter a number: 5 Enter a number: 2 Numbers picked: (2, 5, 6, 10] Balls drawn: [3, 4, 5, 6] Number of matches: 2 Save your Python program in a file named Labo9P2.py. Submit the file to Blackboard for credit.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:30
Why would a programmer use the logical operator and in an if statement? a: when an action is to be taken that requires both conditions to be falseb: when an action is to be taken that requires both conditions to be truec: when an action is to be taken that requires the first condition to be falsed: when an action is to be taken that requires the second condition to be truei took the test and the answer is b.
Answers: 3
question
Computers and Technology, 22.06.2019 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Idon’t understand the double8 coding problem. it is java
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
Per the municipal solid waste report, what are the most common sources of waste (trash
Answers: 3
You know the right answer?
Write a program to simulate a lottery game. (a) Ask the user to pick 4 unique numbers in the range...
Questions
Questions on the website: 13722362