Academic coaching, editing, and research guidance for university students.

def is_divisible(a, b): return a % b == 0 def is_power(a, b): if a == 1: return True if b == 1: return False if not is_divisible(a, b): return False return

1 min read
  

def is_divisible(a, b):     return a % b == 0 def is_power(a, b):     if a == 1:         return True     if b ==  1:         return False     if not is_divisible(a, b):         return False     return is_power(a/b, b)                              print(“is_power(10, 2) returns: “, is_power(10, 2)) print(“is_power(27, 3) returns: “, is_power(27, 3)) print(“is_power(1, 1) returns: “, is_power(1, 1)) print(“is_power(10, 1) returns: “, is_power(10, 1)) print(“is_power(3, 3) returns: “, is_power(3, 3))

Academic integrity note

Use this educational resource to build your understanding. Follow your institution’s rules and cite sources appropriately.

Want feedback on your own work?

Request Academic Support

Leave a Reply

Your email address will not be published. Required fields are marked *