Please review and let me know what can i still do to get optimal solution

programming
Tags: #<Tag:0x00007f182c974140>

#1

def isPower(self, A):
self.A = A
count = 0
failed = []
for x in range(2,int(A/2)+1):
temp = int(A)
ind = 0
count = 0
if len(failed) >= 2:
for y in range(len(failed)):
if x%int(failed[y])==0:
ind = 1
break
if len(failed) < 2 or ind!=1:
while int(A) != 1 or int(A)<1:
if A%x==0:
A = A/x
count += 1
else:
failed.append(x)
break
if count>0:
return 1
else:
return 0