.
unknown
plain_text
2 years ago
207 B
4
Indexable
def is_power_of_b(a, b):
if a == 0:
return False
while a % b == 0:
a /= b
return a == 1
# Example usage:
print(is_power_of_b(27, 3)) # True
print(is_power_of_b(28, 3)) # False
Editor is loading...
Leave a Comment