【leetcode❤python】231. Power of Two
#-*- coding: UTF-8 -*-
class Solution(object):
def isPowerOfTwo(self, n):
if(n<=0):
return False
if(n==1):
return True
while True:
tuple=divmod(n,2)
if tuple[1]!=0:
return False
if tuple[0]==1:
return True
n=tuple[0]
sol=Solution()
print sol.isPowerOfTwo(1025)