Write a method that returns true if a given parameter is a power of 4, and false if it's not. If parameter is not an Integer (eg String, Array) method should return false as well.

(In C# Integer means all integer Types like Int16,Int32,.....)

### Examples

```python
isPowerOf4 1024 #should return True
isPowerOf4  102 #should return False
isPowerOf4   64 #should return True
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def powerof4(n):
	

Solutions:
from math import log

def powerof4(n):
	if type(n) in (float, int) and n > 0:
		return log(n, 4).is_integer()
	return False


from math import log

def powerof4(n):
	return type(n) == int and n >= 0 and log(n, 4).is_integer()


from math import log

def powerof4(n):
	return n == 4 ** round(log(n, 4)) if type(n) == int and n > 0 else False


def powerof4(n):
	t = [int, float]
	if type(n) not in t:
		return False
	if n == 1.0:
		return True
	elif n < 1.0:
		return False
	return powerof4(n / 4.0)


def powerof4(n):
	try:
		b = bin(n)
		if isinstance(n, bool):
			return False
		return b.count('1') == 1 and len(b) % 2 != 0
	except:
		return False


def powerof4(n):
	return type(n) == int and n.bit_length() & 1 and (n == 1 << n.bit_length() - 1)


import math

def powerof4(n):
	if not (isinstance(n, int) and (not isinstance(n, bool)) and (n > 0)):
		return False
	return math.log(n, 4).is_integer()


def powerof4(n):
	if not str(n).isdigit():
		return False
	else:
		n = int(n)
	while n > 4:
		n = n / 4
	if n == 4 or n == 1:
		return True
	return False


def powerof4(n):
	if type(n) != type(1):
		return False
	while n % 4 == 0:
		n = n / 4
	return n == 1