Question: Write a function find_winners (factor, must_have, n) that accepts the following three parameters: 1. The factor-digit (factor ), which is a non-zero digit (i.e., 1-9).

Write a function find_winners (factor, must_have, n) that accepts the following three parameters: 1. The factor-digit (factor ), which is a non-zero digit (i.e., 1-9). 2. The must-have-digit (must_have ), which is also a non-zero digit (i.e., 1-9). 3. The number of participants (n) where the lucky draw numbers will be numbered from 1 to n (inclusive) Your function should return the number of winners (i.e., the number of participants whose lucky draw number is a multiple of factor-digit and contain the must-have-digit). For example, if factor-digit is 3, must-have-digit is 5, and the number of participants is 100, then the number of winners is 6 (the winning numbers are 15, 45, 51, 54, 57 and 75). You are advised to write a helper function contain_digit(number, digit) that returns True if number contains digit, or False otherwise. For example, function call contain_digit(15, 5) returns True. This function will be called by the find_winners (factor, must_have, n) func- tion to check the existence of must-have-digit. Consult your tutor or lecturer, should you have any doubt on the helper function. Restrictions You are not allowed to use any string functions or convert a number to string. However, you may write additional functions as you deem necessary. 0 Sample Run #1 1 >>> print (find_winners (3, 5, 100)) 216 Sample Run #2 >>> print (find_winners (9, 1, 15)) 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
