Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isPowerOfTwo(self, n):
- if n == 0:
- return False
- while n != 0:
- if (n & 1) == 1 and ((n >> 1) != 0):
- return False
- n = n >> 1
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement