Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this: Here is what I have so far: import random #allows Python to pick random numbers def lotteryNum(M): #defining the function

I need help with this:

image text in transcribed

Here is what I have so far:

import random #allows Python to pick random numbers

def lotteryNum(M): #defining the function lotteryPick=[] #Stores the lottery numbers if M=5: #if they are greater or equal to 5, lottery sample will pick through the range lotteryPick= random.sample(range(1,M+1),5) return lotteryPick

Test your function inside the main program lottery.py. Your main program should ask the user for an integer M representing the range M for the lottery. The program should test to ensure the integer is greater than or equal to 5. If not, the program should continue to query the user. Next, your program should call lotteryPick(39) one time to represent your "Quick Pick". A "Quick Pick" represents a random selection made by you. Next, have your main program call lotteryPick(39) again to represent the actual drawing. In addition, have the main program test whether or not your "Quick_Pick" has won by testing if zero, one, two, three, four or five matches have been made - and displaying the result. Finally, ask the user if they would like to play the program again with a "y prompt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions