please code in python # Write code to indicate how many tickets one has to buy approximately to have at least three white ball matching # Logic # Step 1: Buy a ticket with 5 white balls [not identical, between 1-69] and 1 red ball [between 1-26] # Step 2: Continue buying tickets until getting the ticket with at least three white ball matching # Step 3: Record how many tickets one has bought - M #print(totaltry) # Step 4: Repeat steps 1-3 10000 times and record # of tickets as M1, M2, M3, ... M100000 # Step 5: Sum(M1, M2, ... Mn)/10000 is the tickets one has to buy approximately to have at least three white ball matching
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
please code in python
# Write code to indicate how many tickets one has to buy approximately to have at least three white ball matching
# Logic
# Step 1: Buy a ticket with 5 white balls [not identical, between 1-69] and 1 red ball [between 1-26]
# Step 2: Continue buying tickets until getting the ticket with at least three white ball matching
# Step 3: Record how many tickets one has bought - M #print(totaltry)
# Step 4: Repeat steps 1-3 10000 times and record # of tickets as M1, M2, M3, ... M100000 # Step 5: Sum(M1, M2, ... Mn)/10000 is the tickets one has to buy approximately to have at least three white ball matching
Step by step
Solved in 3 steps