Thinking:

the value of power of 2 must not be negative.

So eliminate the negative situation.

Then we get started to divide n by 2 iteratively.

At very end, if n can be totally divided by 2, 1 is finally left.

```
class Solution(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
if n <= 0:
return False
while n % 2 == 0:
n = n / 2
return n == 1
```