Power of Another Number Python
PROGRAM TO CHECK IF A NUMBER IS POWER OF ANOTHER NUMBER
OUTPUT
1
import math def isPower(x, y): # logarithm function to # calculate value res1 = math.log(y) // math.log(x); # Note : this is double res2 = math.log(y) / math.log(x); # compare to the result1 or # result2 both are equal return 1 if(res1 == res2) else 0; # Driver Code if __name__=='__main__': print(isPower(27, 729));
1
Comments
Post a Comment