In this Kata we are passing a number (n) into a function. 

Your code will determine if the number passed is even (or not). 

The function needs to return either a true or false. 

Numbers may be positive or negative, integers or floats.

Floats are considered UNeven for this kata.

Difficulty: introductory

Starter code:

def is_even(n):
	

Solutions:
def is_even(n): 
    return n%2 == 0

def is_even(n):

#a modulos will return the whole number remainder of a division

#using the modulos sign with 2 and another number will only return 0 and 1 

#if the remainder of n and 2 is equal to 1 the number will be odd
   
    if (n % 2) == 1:
      return False
      
    #if the remainder of n and 2 is equal to 0 the number will be even
    
    elif (n % 2) == 0:
      return True 
      
    #if n is not an integer (i.e a float) return False
    
    elif (n) != int: 
      return False 
      
    #Done ( ಠ ͜ʖಠ)


is_even = lambda n: n % 2 == 0

def is_even(n): 
    return (isinstance(n,int) and n % 2 == 0)





def is_even(n): 
    output = False
    if n % 2 == 0:
        output = True
    return output

def is_even(n): 
    return type(n) != float and n % 2 == 0

def is_even(n): 
    if n % 2 == 0:
        return True
    else:
        return False

def is_even(n): 
  if n % 2 == 0:
    return True
  else:
    if n % 2 != 0:
      return False


def is_even(n): 
    if n % 2 == 0:
        return True
    if n % 2 != 0:
        return False


def is_even(number): 
    if isinstance(number, float):
        even = False
    else:
        result = number % 2
        even = not result
    return even

def is_even(n): 
    if isinstance(n, float):
        return False
    else:
        return not (n % 2)

def is_even(n): 
    if type(n) == float:
        return False
    if n % 2 == 0:
        return True
    return False

def is_even(n):
    return n % 2 == 0 if type(n) == int else False

def is_even(n): 
    # your code here
    if type(n)!=int:
        return False
    elif n%2==1:
        return False
    else:
        return True

def is_even(n): 
    return True if n%2 == 0 and type(n) != float else False

def is_even(n): 
    return False if type(n)==float else n&1==0

def is_even(n): 
    return True if n//1 == n and n%2 - 1 else False

def is_even(n): 
    return True if (n/2).is_integer() else False

def is_even(n): 
    # your code here
    
    if type(n) == int and n % 2 == 0:
        return True
    else:
        return False

is_even = lambda n: not n % 2

def is_even(n): 
    return False if n % 2 else True

def is_even(n):
    return not n % 2

def is_even(n): 
    a = n/2
    if a.is_integer():
        return True
    else:
        return False

def is_even(n): 
    if n == 1:
        return False
    if n//2 == n/2:
        return True
    else:
        return False


def is_even(n): 
    if isinstance(n, int):
        if n % 2 == 0:
            return True
    return False

def is_even(n): 
    if n % 1 != 0: return False 
    elif n % 2 == 0:
        return True
    else: 
        return False

def is_even(x):
    if x % 2==0:
        return True
    else:
        return False


def is_even(n: int) -> bool:
    """ Check if given number is even. """
    return not n % 2

def is_even(n):
    try:
        return bin(n)[-1] == '0'
    except TypeError:
        return False

def is_even(n): 
    return type(n)==int and (n+1)%2

def is_even(n): 
    return False if isinstance(n, float) else not bool(n % 2)

def is_even(n): 
    """ This function returns True if 'n' is even else False. """
    return True if n % 2 == 0 else False 

def is_even(n): 
    # your code here
    return True if 0==n%2 else False

def is_even(n): 
    return n % 2 == 0 if n is not type(float) else False

def is_even(n): 
    flag = False
    if(not(n % 2)):
        flag = True
    return flag

def is_even(n): 
    return n % 2 == 0 or n % -2 == 0


def is_even(n): 
    return False if n % 2 > 0 else True

def is_even(n): 
    return n%2 == False

def is_even(n): 
    return n % 2 == 0
#pogchamp


def is_even(n): 
    if n % 2 == 0:
        return True
    else:
        return False
#pogchamp


def is_even(n): 
    return type(n)==int and not n&1

def is_even(n): 
    return (n//2)*2==n

def is_even(n):
    if (n==float):
        return False
    elif(n%2==0):
        return True
    elif(n%2!=0):
        return False
    
print((is_even(32)))


def is_even(n): 
    if n%2 == 0:# check if number divided by 2 has a remainder of zero
        return True
    else:
        return False
    
    pass

def is_even(n): 
    # your code here
    return not n&1 if type(n)==int else False

import unittest


def is_even(n):
    return n % 2 == 0
    
    
class TestIsEven(unittest.TestCase):
    def test_is_even_with_even(self):
        self.assertTrue(is_even(4))

    def test_is_even_with_odd(self):
        self.assertFalse((is_even(5)))


def is_even(n): 
    if isinstance(n, int) is True:
        if n%2==0:
            return True
        else:
            return False
    else:
        return False

def is_even(n): 
    a = abs(n)
    if a % 2 == 0:
        return True
    else:
        return False

def is_even(n): 
    return type(n) is int and not n%2

def is_even(n): 
    return n%2 == 0 or False

def is_even(n): 
    """(^__^)"""
    if n % 2 ==0:
        return True
    else:
        return False


def is_even(n): 
    return float(n)%2==0

def is_even(n): 
    if n % 2 == 0 and not isinstance(n, float):
        return True
    else:
        return False


def is_even(n): 
    if n %2 == 0:
        return n == n
    else:
        return n != n


def is_even(n):
    return n % 2 == 0 or type(n) == type(float)        


def is_even(n): 
    if n is float:
        return False
    elif n%2==0:
        return True
    else:
        return False
    pass

def is_even(n):
    a = n / 2
    if a == int(a):
        return True
    else:
        return False

def is_even(n): 
    if isinstance(n, float): return False
    if n % 2 != 0: return False
    return True
    
    pass

def is_even(n): 
    return float(int(n % 2 ==0))

def is_even(n):
    return not n & 1 if type(n) is int else False

def is_even(n):
    if n % 2 == 0:
        return True
    elif n % 2 == 1 or n == float(n):
        return False


def is_even(n):
        return n % 2 is 0

def is_even(n): 
    bool=False
    if n%2==0:
        bool=True
    return bool

def is_even(n): 
    print(n/2)
    if n % 2 == 0: return True
    else: return False

def is_even(n):
    gg = int(n)
    if len(str(n))==len(str(gg)):
        if n%2==0:
            return True
    return False

def is_even(n):
    n = abs(n)
    if isinstance(n, float) or n%2==1:
        return False
    else:
        return True

def is_even(n): 
    if n % 2 == 0 and type(n) != float:
        return True
    else:
        return False

def is_even(n): 
    while n > 0 or n < 0:
        if n % 2 == 0:
            return True
        else:
            return False
    if n == 0:
        return True


def is_even(n): 
        if n % 2 == 0: # your code here
            return (True)
        else:
            return (False)
is_even(0)



def is_even(n): 
    return 1 if abs(n)%2==0 else 0


def is_even(n): 
    if isinstance(n, int):
        if abs(n) % 2 == 0:
            return True
    return False


def is_even(n):
    return n%2 == 0 
#CodeMast3f


def is_even(n): 
    return not n % 2 if not n % 1 else False

def is_even(n): 
    a = n % 2
    if a == 0:
        return True
    return False
    pass

def is_even(n):
    even = True
    if (n % 2) > 0:
        even = False
        return False
    elif (n % 2) == 0:
        even = True
        return True


def is_even(n):
    if n % 2 == 0:
        return True
    else:
        return False
    return n
        


def is_even(n): 
    # your code here
    n /= 2
    if n == int(n):
        return True
    else:
        return False

def is_even(n):
    result = True

    if type(n) == float or n % 2 != 0:
        result = False

    return result

def is_even(n: int) -> bool:
    return n % 2 == 0

def is_even(n): 
    # your code here
    if type(n) == float:
        return False
    if type(n) == int:
        if n%2 == 0:
            return True
        if n%2 == 1:
            return False

def is_even(n): 
    return not n%2 if isinstance(n, int) else False

def is_even(n): 
    return 1 if n % 2 == 0 else 0

def is_even(n): 
    return False if type(n) == float else not abs(n) % 2

def is_even(n): 
    return n % 1 == 0 and n % 2 == 0

def is_even(n = 0):
    if (n % 2) == 0:
        return True
    else:
        return False

def is_even(n): 
    return True if type(n) is int and n % 2 == 0 else False

def is_even(n): 
    x = True if n % 2 == 0 else False
    return x

is_even = lambda n : n%2==0 and isinstance(n, int) or 0

def is_even(n): 
    # your code here
    return isinstance (n,int) and (abs(n) % 2 == 0 )

def is_even(n): 
    return n//2 == n/2

def is_even(n): 
    results = False
    if n % 2 == 0:
        results = True
    return results
      
    


def is_even(n): 
    if n % 2 == 0:
      even = True
    else:
        even = False
    return even

def is_even(n): 
    n = n/2
    if n - n//1 == 0:
      return True
    else: 
      return False

def is_even(num): 
    return num %2==0


def is_even(n): 
    return False if type(n) == float else n%2 == 0

def is_even(n):
    if (n % 2) == 1:
      return False   
    elif (n % 2) == 0:
      return True 
    elif (n) != int: 
      return False 

def is_even(n): 
    torf = False
    if n%2 == 0:
        torf = True
        return torf
    else:
        return torf
    pass

def is_even(n):
  if type(n) == int:
    if (n % 2) == 0:  
      t_f = True  
    else:  
      t_f = False
  else:
    t_f = False
  return(t_f)  


def is_even(n): 
    if (n % 2) == 0:
        return True
    elif n is float:
        return False
    else:
        return False

def is_even(n): 
    if not n % 2:
        return True
    return False