Question: 1 . Using the partial code on the following page, write a function named play lotto ( ) that simulates a lottery where players try

1. Using the partial code on the following page, write a function named
play lotto() that simulates a lottery where players try to predict a
sequence of randomly drawn numbers. Follow the guidelines below.
(a) The first parameter of the function should be named picks and it
should be variadic.
Note: This parameter represents the numbers that the player picks.
Since it is variadic, the player may pick how ever many numbers they
would like (and the function will simulate a lotto with that many win-
ning numbers).
(b) The second parameter of the function should be named max and it
should have a default value of 50.
(c) Give the function a descriptive docstring.
(d) Import the function from the random module that we have used to
make multiple random selections from a collection where
repetition is not allowed.
(e) Assign the variable n to be the length of the tuple named picks.
(f) Using the function you imported in part (d), randomly select n numbers
that can range from 1 to max.
(g) In the if-block, bump up the value of matches by 1.
2. Use the function to simulate a pick-5 lottery, leaving the max value to be
its default value.
3. Use the function to simulate a pick-3 lottery with a max value of 10.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!