Solve the problem by using Python. Write a function another one that takes the f
ID: 3586738 • Letter: S
Question
Solve the problem by using Python. Write a function another one that takes the following arguments, in this order: 1. integer: a positive integer 2. divisor: any integer, including zero Your function should return the number of times the given integer can be divided by the divisor until the quotient is less than 1. That is, divide integer by divisor, add one to a count, and replace integer with the quotient. For instance, suppose integer is 13 and divisor is 2. The following set of divisions will be performed: 13÷2=6 6÷2=3 3÷2=1 1÷2=0. In the case, the function would return 4. If divisor equals 0, the function simply returns 0 Examples: Function Call another one (123, 2)7 another one (512, 3) 6 another.one (132, 5) 4 Return ValueExplanation / Answer
# Source code uploaded to -> https://gist.github.com/anonymous/d67deac395e5f6fd6e3b29c6cd56a9ba
def another_one(integer, divisor):
if divisor == 0:
return 0
if integer/divisor == 0:
return 1
return 1 + another_one(integer/divisor, divisor)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.