logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Yehuda ThomsonPsychology
(5/5)

588 Answers

Hire Me
expert
Clifford BillmanBusiness
(5/5)

566 Answers

Hire Me
expert
Persimmon BissoondathhCriminology
(5/5)

710 Answers

Hire Me
expert
Sohail AliScience
(5/5)

703 Answers

Hire Me
Python Programming
(5/5)

Lottery games award players for money if they are able to match two, three four, or five integers from integers selected

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Question 1 (20 Points)

Lottery games award players for money if they are able to match two, three four, or five integers from integers selected at random in a range 1 to M (inclusive of M). Simulate a lottery game by designing a well-documented Python function, lotteryPick(M) that accepts an integer greater than five and returns a list of randomly selected integers. You will need to use Python’s random module. Also, consider using the sample function embedded in the random module. Your call to sample should be of the form sample(range(1, M+1),5). In addition, your function should NOT return a value when the user selects an M less than 5. Under this condition have your function return an empty list.

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/n prompt?”.

Grading: 4 Points for comments, 4 Points for python function lotteryPick(M), 8 Points for the main program lottery.py that tests your function appropriately and 4 Points for a screen capture that depicts the display your main program creates after a drawing.

Screen Capture

Question 2 (20 Points)

Lottery games award players for money if they are able to match two, three four or five integers from integers selected at random in a range 1 to M (inclusive of M). Design a well-documented, Python main program that uses the function lotteryPick(M) to estimate the probability of winning a lottery game in the range 1 to M (inclusive of M) by repeating the lottery game 10N trials. Ask the user for the value of N as a prompt in your program lottery2.py. To estimate the probability of winning with only one match, for example, have your code count the number of times one match is found in 10N trials and divide it by the number of trials.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme