Computer Science, asked by User3412, 10 months ago

Fill in the blanks to make the is_power_of function return whether the number is a power of the given base. Note: base is assumed to be a positive number. Tip: for functions that return a boolean value, you can return the result of a comparison.

Answers

Answered by shaswatpattnayak6200
3

Answer:

3 to the power 4

Answered by ashikurrahman068
26

Answer:

def is_power_of(number, base):

 # Base case: when number is smaller than base.

 if number < base:

   # If number is equal to 1, it's a power (base**0).

   return number == 1

 result = number//base

 # Recursive case: keep dividing number by base.

 return is_power_of(result, base)

Explanation:

Similar questions