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 10:30
This first part of the film shows the early history of motion pictures. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theatre productions? explain. in the scene where don is going to the party (starting at time code 14: 51), we see a street scene as he first rides with cosmo and then with kathy. what aspects did the filmmaker include to make the scene look and feel like don, cosmo, and kathy are riding in a car on a street? think about elements such as scenery, sound, props, lighting, and so on. a "talkie" picture is shown starting around time code 21: 15. how does the audience in the film react to the "talkie"? what influence do audiences have on film and theatre performances? how do film and theatre actors influence audiences? in the musical scene with cosmo (starting at time code 27: 00), how does the actor use props? what is the result? do you think the use of props effectively fulfilled the artistic vision for this musical number? why or why not?
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
question
Computers and Technology, 24.06.2019 12:00
An npn transistor is correctly biased and turned on if the a. base is negative. b. collector is negative. c. collector is positive with respect to the emitter and negative with respect to the base. d. collector is the most positive lead followed by the base.
Answers: 1
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
question
Biology, 14.01.2020 21:31
question
Computers and Technology, 14.01.2020 21:31