Took a bit of time to crack this down


#1

def isPower(self, A):
for power in range(2,33):
temp=round(A**(1/power))
if(temp**power==A):
return 1
return 0

#executed successfully


#2

How did you come up with the number 33?


#3

Because the question has mentioned about 32 bit signed integer. So we need only 32 places. Reply again if you did not get what’s happening with the code.
Cheers!