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, 21.06.2019 22:00
Some of your friends have gotten into the burgeoning field of time-series data mining, in which one looks for patterns in sequences of events that occur over time. purchases at stock exchanges"what's being bought" are one source of data with a natural ordering in time. given a long sequence s of such events, your friends want an efficient way to detect certain "patterns" in them"for example, they may want to know if the four events buy yahoo, buy ebay, buy yahoo, buy oracle occur in this sequence s, in order but not necessarily consecutively. they begin with a collection of possible events (e.g., the possible transactions) and a sequence s of n of these events. a given event may occur multiple times in s (e.g., yahoo stock may be bought many times in a single sequence s). we will say that a sequence s is a subsequence of s if there is a way to delete certain of the events from s so that the remaining events, in order, are equal to the sequence s . so, for example, the sequence of four events above is a subsequence of the sequence buy amazon, buy yahoo, buy ebay, buy yahoo, buy yahoo, buy oracle their goal is to be able to dream up short sequences and quickly detect whether they are subsequences of s. so this is the problem they pose to you: give an algorithm that takes two sequences of events"s of length m and s of length n, each possibly containing an event more than once"and decides in time o(m + n) whether s is a subsequence of s.
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
What makes myhexadecimalnumber a child of mynumber? which methods does myhexadecimalnumber inherit directly from the mynumber class? what can an instance of the mynumber class do? what can an instance of the myhexadecimalnumber class do? which methods are overridden? why are they overridden? how many examples of overloading are there? why was this done? where is the super keyword used? what is it doing? why isn’t the incoming value set immediately in the second myhexadecimalnumber constructor? how many examples can you find of an inherited method being called?
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
Which argument is not a valid filter? does not equal this quarter filter by cell color all of these are valid filter arguments.
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Name the range function that would generate the following list of integers values: 0,1,2,3,4,5.
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
English, 02.05.2021 05:20
question
Arts, 02.05.2021 05:20
question
Computers and Technology, 02.05.2021 05:20
Questions on the website: 13722360