Question: A small lottery was devised using three sets of balls. One ball from each set is drawn. To win the lottery you have to get

A small lottery was devised using three sets of balls. One ball from each set is drawn. To win the lottery you
have to get the correct number of the sum of the three balls. The sum of the balls cannot be divisible by 7 or 9.
The balls are redrawn until the sum is not divisible by 7 or 9. The first set of balls has the numbers 0 through
10(0,1,2,3dots,10). The second set of balls has the even numbers from 0 to 20(0,2,4,dots20), and the third set
counts by 3's to 30(0,3,6,dots,30). Write a program that has as input a number that has been chosen by a lottery
participant (win_number). The program should return the number of possible winning permutations for
win_number (winning_permutations), and the total number of possible permuations (total_permutations).
total_permutations should not include permutations that are divisible by 7 or 9.
M def win(win_number):return winning_permutations,total_permutations
M
assert win(14)==(0,992)
assert win(12)==(18,992)
assert }\operatorname{win}(39)==(34,992
Write a program that calls the function that you have just written, win(), to find the win_number that is most
probable (best_pick). Please notice that you should return win_number and not the number of winning
permutations of win_number. If you have written win() correctly, there is one win_number that has the greatest
number of possible winning combinations.
Calling win() returns two values. The following cell demonstrates how to call a function with more than one
returned value.
a,b=win(12)
pr(a)
pr(b)
| def max_win_number():return best_pick
A small lottery was devised using three sets of

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!