.

 avatar
unknown
plain_text
a year ago
207 B
3
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