Test if number is power of base

PHOTO EMBED

Thu Jan 13 2022 19:23:38 GMT+0000 (Coordinated Universal Time)

Saved by @Seanleeduncan #python

def power(base, exp):

   if (exp == 1):
      return (base)
   if (exp != 1):
      return (base * power(base, exp - 1))

   base = int(input("Enter base: "))
   exp = int(input("Enter exponential value: "))

   print("Result:", power(base, exp))
content_copyCOPY