Advertisement
Guest User

Untitled

a guest
May 27th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. class Solution(object):
  2. def isPowerOfFour(self, num):
  3. """
  4. :type num: int
  5. :rtype: bool
  6. """
  7. if num <= 0:
  8. return False
  9. while (num % 4 == 0):
  10. num = num / 4
  11. if num == 1:
  12. return True
  13. else:
  14. return False
  15.  
  16. P = Solution()
  17. P.isPowerOfFour(123)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement