Question
EDIT: Here is the full question along with sample outputs Posting this question for the second time. Can you take this function: import random #allows
EDIT: Here is the full question along with sample outputs
Posting this question for the second time. Can you take this function:
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
Modify the code and make a main program that repeats the lottery game 10n trials. Have it ask the user for the value of n as a prompt. To estimate the probability of winning with only one match, have your code count the number of times one match is found in 10n trials and divide it by the number of trials.
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 10 trials and divide it by the number of trials Grading: 2 Points for comments, 6 Points for the main program lottery2.py and 2 Points for a screen capture that depicts the respective probabilities after one million trials. Enter M, the Lottery Range Greater Equal To 5 39 Enter the number of Times to Play the Lottery 10N 8 (0: 48333816, 1: 40269988, 2:10394198, 3: 972492, 4: 29337, 5: 169) logout Unscaled Screen Capture Yours Should Be Scaled! Number 0 Count Count/Ntrial Ntrial/Count 48333816 0.48333816 2.06894486 40269988 0.40269988 2.48323888 10394198 0.10394198 9.62075188 972492 0.00972492 102.828609 293370.00029337 3408.66483 0.00000169 591715.976 NYLOTTERY 9.62 102.63 3,386.81 75,757.00 4 5 169 Ntrials 100000000 Winnin 11396196 0.11396196 8.77485786 8.77 100 Million Trials (Ten Times the Number Required For The Assignment)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started