The number n is Evil if it has an even number of 1's in its binary representation.
The first few Evil numbers: 3, 5, 6, 9, 10, 12, 15, 17, 18, 20
The number n is Odious if it has an odd number of 1's in its binary representation.
The first few Odious numbers: 1, 2, 4, 7, 8, 11, 13, 14, 16, 19
You have to write a function that determine if a number is Evil of Odious, function should return "It's Evil!" in case of evil number and "It's Odious!" in case of odious number.

good luck :)

Difficulty: introductory

Starter code:

def evil(n):
	

Solutions:
def evil(n):
    return "It's %s!" % ["Evil","Odious"][bin(n).count("1")%2]

def evil(n):
    return "It's Evil!" if  bin(n).count('1')%2 == 0 else "It's Odious!"

def evil(n):
    return 'It\'s {}!'.format(('Evil', 'Odious')[bin(n).count('1') % 2])


def evil(n):
    count = 0
    while n:
        n &= n - 1
        count += 1
    return "It's Odious!" if count & 1 else "It's Evil!"

def evil(n):
    return f"It's {('Evil', 'Odious')[bin(n).count('1')&1]}!"

def evil(n):
    return f"It's {['Odious', 'Evil'][bin(n).count('1') % 2 == 0]}!"

def evil(n):
    return ["It's Odious!", "It's Evil!"][not str(bin(n)[2:]).count('1') % 2]

def evil(n):
    return 'It\'s Odious!' if bin(n)[2:].count('1')%2 else 'It\'s Evil!'

evil = lambda n: "It's %s!" % ("Evil" if len(list(filter(lambda d: d == '1', list(bin(n))))) % 2 == 0 else "Odious")

def evil(n):
    evil = bin(n)[2:].count('1') % 2 == 0
    return "It's Evil!" if evil else "It's Odious!"

def evil(n):
    count_one = str(bin(n)).count('1')
    if count_one % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    bin_number = bin(n)
    count = 0
    for i in bin_number:
        if i == '1':
            count += 1
    if count%2==0:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    n=int(n)
    b =[2**i for i in range(100)]
    d = b[::-1]
    c=0
    for i in d:
        if int(n-i)>=0:
            c+=1
            n-=i
    if c%2==0:
        return "It's Evil!"
    else:
        return "It's Odious!"
    pass

def evil(n):
    return "It's Odious!" if bin(n).count('1') % 2 else "It's Evil!"

def evil(n):
    n = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333)
    n = (n & 0x0F0F0F0F0F0F0F0F) + ((n >> 4) & 0x0F0F0F0F0F0F0F0F)
    n = (n & 0x00FF00FF00FF00FF) + ((n >> 8) & 0x00FF00FF00FF00FF)
    n = (n & 0x0000FFFF0000FFFF) + ((n >> 16) & 0x0000FFFF0000FFFF)
    n = (n & 0x00000000FFFFFFFF) + ((n >> 32) & 0x00000000FFFFFFFF)
    
    return "It's Odious!" if n % 2 == 1 else "It's Evil!"

evil = lambda n: ["It's Evil!","It's Odious!"][bin(n).count('1')%2]

def evil(n):
    n_bin = bin(n)[2:]
    ones = n_bin.count('1')
    if (ones % 2 != 0):
        return 'It\'s Odious!'
    else:
        return 'It\'s Evil!'

def evil(n): return "It's Odious!" if bin(n).count('1')&1 else "It's Evil!"

def evil(a):
    return "It's Odious!" if str(bin(a)).count('1') % 2 == 1 else "It's Evil!"


def evil(n):
    return "It's {}!".format(('Evil', 'Odious')[f'{n:b}'.count('1') % 2])

def evil(n):
    return bin(n).count("1") % 2 and "It's Odious!" or "It's Evil!"

import re

def evil(n):
    binary = "{0:b}".format(n)
        
    return f"It's {'Evil' if len(re.findall('1', binary)) % 2 == 0 else 'Odious'}!"

def evil(n):
  x = bin(n)
  counts = x.count("1")
  if counts % 2==0:
    return "It's Evil!"
  else:
    return "It's Odious!"

def evil(n: int) -> str:
    """
    Check if the given number is:
     - evil: it has an even number of 1's in its binary representation
     - odious: it has an odd number of 1's in its binary representation
    """
    return f"It's {'Odious' if str(bin(n)).count('1') % 2 else 'Evil'}!"

evil = lambda n: ["It's Evil!", "It's Odious!"][bin(n).count("1") & 1]

evil=lambda n: "It's Odious!" if bin(n).count("1")%2 else "It's Evil!"

def evil(n):
    c = 0
    while(n):
        c += n & 1
        n >>= 1
    
    if c & 1:
        return("It's Odious!")
    else:
        return("It's Evil!")

def evil(n):
    return "It's Odious!" if sum(map(int, bin(n)[2:])) % 2 else "It's Evil!"

def evil(n):
    return  "It's Odious!" if sum(map(int, bin(n)[2:])) & 1 else "It's Evil!"

def evil(n):
    return ["It's Evil!","It's Odious!"][format(n, "b").count('1') % 2]

def evil(n):
    count = 0
    while n > 0:
        if (n >> 1) << 1 != n:
            count += 1
        n >>= 1
    if count % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    e = 0
    while n:
        n = n & (n-1)
        e += 1
    return "It's Evil!" if e & 1 == 0 else "It's Odious!"

def evil(n):
    return 'It\'s Evil!' if bin(n)[2:].count('1') % 2 == 0 else 'It\'s Odious!'

def evil(n):
    _odious = "It's Odious!"
    _evil = "It's Evil!"
    
    is_evil = True
    for degree in evilometer(n):
        is_evil = not is_evil
    
    return is_evil and _evil or _odious
        
def evilometer(n):
    while n != 0:
        if n % 2 == 1:
            yield
        n = n // 2
    
def expand_to_string(n):
    binary = ""
    while n != 0:
        binary += str(n % 2)
        n = n // 2
    return binary

def evil(n):
    return "It's Evil!" if not bin(n)[2:].count("1")%2 else "It's Odious!"

evil = lambda n: "It's %s!" % ['Evil', 'Odious'][bin(n).count('1') % 2]

def evil(n):
    bin_rep = str(bin(n))
    state = "Evil" if bin_rep.count("1") % 2 == 0 else "Odious"
    return f"It's {state}!"

def evil(n):
    x=bin(n).count('1')
    test= 'Odious' if x%2 else 'Evil'
    return "It's {}!".format(test)
#test = x.count(1)


def evil(n):
    evil_odious_count = str(bin(n).replace("0b", "")).count("1")
    return "It's Evil!" if evil_odious_count % 2 == 0 else "It's Odious!"

def evil(n):
    binary = bin(n)[2:]
    binary_string = str(binary)
    num_of_1s = binary_string.count('1')
    if num_of_1s % 2 == 0:
        return "It's Evil!"
    else:
         return "It's Odious!"

def evil(n):
    n=bin(n)
    count=0
    for x in n:
        if x=="1":
            count+=1
    return "It's Evil!" if count%2==0 else "It's Odious!"

def evil(n):
    n = bin(n)[2:]

    return "It's Evil!" if n.count('1') % 2 == 0 else "It's Odious!"

def evil(n):
    str = bin(n)
    total = sum(a == '1' for a in str)
    return "It's Odious!" if total%2 != 0 else "It's Evil!"

def evil(n):
    return "It's Odious!" if int(str(bin(n))[2:].count('1'))&1 else "It's Evil!"

evil = lambda n: "It's " + ('Odious!' if str(bin(n)).count('1')&1 else 'Evil!')

def evil(n):
    num = bin(n)
    ones = 0 
    for i in num:
        if i == '1':
            ones += 1
    return "It's Evil!" if ones % 2 == 0 else "It's Odious!"

def evil(n):
    return "It's " + ("Evil!" if bin(n).count("1")%2==0 else "Odious!")

def evil(n):
    binary = bin(n).replace("0b", "") 
    
    return "It's Evil!" if binary.count('1') % 2 == 0 else "It's Odious!"

def evil(n):
    return "It's Evil!" if sum([1 for i in bin(n) if i=='1']) % 2 == 0 else "It's Odious!"

def evil(n):
    binary = bin(n)
    
    ones = 0
    
    for i in binary:
        if i == '1':
            ones = ones + 1
    
    if ones % 2 == 0:
        return "It's Evil!"
    
    return "It's Odious!"

def evil(n):
    return 'It\'s Odious!' if sum(map(int,list(bin(n)[2:])))%2 else 'It\'s Evil!'

def evil(n):
    return 'It\'s Evil!' if sum([int(i) for i in list(bin(n))[2:]]) % 2 == 0 else 'It\'s Odious!'

def evil(n):
    return "It's {}!".format('Odious' if sum(map(int, bin(n)[2:])) % 2 else 'Evil')

def evil(n):
    a = bin(n)
    b = str(a)
    c = b.count("1")
    if int(c) % 2 == 0: 
        return "It's Evil!"
    if int(c) % 2 != 0:
        return "It's Odious!"


def evil(n):
    binary = bin(n)[2:]

    count = 0
    for i in str(binary):
        if i == '1':
            count += 1
    
    if count % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"


def evil(n):
    n=bin(n)
    s=str(n)
    c1=0
    for i in s:
        if(i=='1'):
            c1+=1
    if(c1%2==0):
        return("It's Evil!")
    else:
        return("It's Odious!")


def evil(n):
    return ["It's Evil!", "It's Odious!"][f'{n:b}'.count('1')%2]

def evil(n):
    b = format(n, 'b')
    if b.count('1') % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    return "It's Evil!" if (sum([i == '1' for i in str(bin(n))]) % 2 == 0) else "It's Odious!"

def evil(n):
    n = str(bin(n))
    b = n.replace('0b', '')
    b = int(b)
    d = [int(i) for i in str(b)]
    if d.count(1) % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"


def evil(n):
    return f"It's {'Evil' if bin(n)[2:].count('1') %2==0 else 'Odious'}!"


def evil(n):
    n = bin(n) [2:]
    ans = n.count('1')
    if ans % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"


def evil(n):
    c=bin(n)
    if str(c).count("1")%2==0:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    n_as_bin_string = "{0:b}".format(n)
    nof_ones = n_as_bin_string.count('1')
    return "It's Odious!" if nof_ones % 2 else "It's Evil!"

def evil(n):
    count = 0
    while n:
        n &= n - 1
        count += 1
    if count & 1:
        return "It's Odious!"
    else:
        return"It's Evil!"

def evil(n):
    return "It's Odious!" if int(bin(n).count("1")) % 2 == 1 else "It's Evil!"

def evil(n):
    if not bin(n)[2:].count('1')%2:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    print(bin(n))
    return "It's Evil!" if bin(n).count("1") % 2 == 0 else "It's Odious!"

def dec_to_binary(n, n_bits=8):
    bin_list=[]
    x=n
    while x>0:
        bit=x%2
        print(x, bit)
        bin_list.append(bit)
        print(bit)
        x//=2
    return bin_list


def evil(n):
    if dec_to_binary(n).count(1)%2==1:
        return "It's Odious!"
    else:
        return "It's Evil!"

def binary_places(num):
    current_num = num
    values_list = []

    if current_num % 2 == 1:
        values_list.append(1)
        current_num -= 1
    else:
        values_list.append(0)

    if current_num > 0:
        cumulative_values = 2

        while cumulative_values <= current_num:
            values_list.insert(0, "?")
            cumulative_values *= 2

    this_place_value = 2 ** (len(values_list) - 1)
    current_place = 0

    while current_num > 1:

        if current_num >= this_place_value:
            values_list[current_place] = 1

            current_num -= this_place_value
            current_place += 1
            this_place_value /= 2
        else:
            values_list[current_place] = 0
            current_place += 1
            this_place_value /= 2

    for index, char in enumerate(values_list):
        if char == '?':
           values_list[index] = 0

    return values_list


def evil(n):
    num_list = binary_places(n)

    if 1 in num_list and num_list.count(1) % 2 == 0:
        return "It's Evil!"
    elif 1 in num_list and num_list.count(1) % 2 == 1:
        return "It's Odious!"


def int_to_bin(n):
    
    bin_lst=[]
    x = n 
    while x > 0: 
        bit= x % 2
        bin_lst.append(bit)
        x//=2
       
    return bin_lst[::-1]

         
def evil(n):
    if int_to_bin(n).count(1)%2==1:
        return "It's Odious!"
    else: 
        return "It's Evil!"



def dec_to_binary(n):
    bin_list = []
    x = n
    
    while x > 0:
        bit = x % 2
        bin_list.append(bit)
        x //= 2
        
    return bin_list[::-1]

def evil(n):
    if dec_to_binary(n).count(1) % 2 == 1:
        return "It's Odious!"
    else:
        return "It's Evil!"
    pass

def dec_to_bin(n):
    bin_list = []
    x = n

    while x > 0:
        bit = x % 2
        bin_list.append(bit)
        x //= 2
        
    return bin_list
    
def evil(n):
    binary = dec_to_bin(n)
    if binary.count(1) % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"


def evil(n):
    bit = bin(n)
    if bit.count('1') % 2 == 0:
        return "It's Evil!"
    return "It's Odious!"

def evil(n):
    count=0
    for x in str(bin(n)[2:]):
        if x=="1":
            count+=1
    return "It's Odious!" if count%2 else "It's Evil!"
        
    


def evil(n):
    return "It's Odious!" if bin(n)[1:].count('1')%2==1 else "It's Evil!"

def evil(n):
    s = []                        # List reminder
    length = (n+2) // 2
    for i in range(length):
        r = n % 2
        s.append(r)
        if n // 2 == 0:
            break
        n = n//2
    
    s_reverse = s[::-1]           # reverse list
    binary = ""                   # conversion to string
    for n in s_reverse:
        binary += str(n)
    
    count = 0                    # Ones count
    for s in binary:
        if s == "1":
            count += 1
        
    if count % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    return "It's {}!".format(["Evil", "Odious"][bin(n)[2:].count("1")%2])

def evil(anum):
    thecount = bin(anum).count('1')
    if thecount % 2 == 0:
        return 'It\'s Evil!'
    elif thecount % 2 != 0:
        return 'It\'s Odious!'

def evil(n):
    verdict = "Odious" if bin(n).count('1') % 2 else "Evil"
    return f"It's {verdict}!"

def evil(n):
    return 'It\'s Odious!' if n<=2 or bin(n)[2:].count('1')%2 else "It's Evil!"

def evil(n):
    x = str(bin(n))[2:]
    t = 0
    for i in x:
        if i == "1":
            t+=1
    
    if t % 2 == 0 and t >= 1:
        return "It's Evil!"
    else:
        return "It's Odious!"

def evil(n):
    binary=bin(n).replace("0b", "")
    count=0
    for i in str(binary):
        if i=='1':
            count=count+1
    if count%2==0:
        return "It's Evil!"
    return "It's Odious!"

def evil(n):
    count = 0
    for x in bin(n):
        if x=='1':
            count+= 1
            
    return "It's Evil!" if count%2==0 else "It's Odious!"


def evil(n):
    n=str(bin(n)).count('1')
    return 'It\'s {}!'.format(['Odious', 'Evil'][n%2==0])

def evil(n):
    r = 0
    while n > 0:
        r += n%2
        n //= 2
    
    return "It's Odious!" if r%2 else "It's Evil!"

def evil(n):
    count_1 = bin(n).count('1')
    msg = "It's Evil!"
    if count_1 % 2:
        msg = "It's Odious!"
    return msg

def evil(n):
    bin_str = str(bin(n))
    sum = bin_str[2:].count('1')
    msg = "It's Evil!"
    if sum % 2:
        msg = "It's Odious!"
    return msg

def evil(n):
    b=bin(n)
    l=list(b)
    return "It's Evil!" if l[2:].count("1")%2==0 else "It's Odious!"

def evil(n):
    n=bin(n)
    count_one=n.count('1')
    if count_one%2==0:
        return ("It's Evil!")
    else:
        return ("It's Odious!")

def evil(n):
    if int(list(bin(n)).count('1')) % 2 != 0:
        print((list(bin(n)), list(bin(n)).count('1')))
        return "It's Odious!"
    else: 
        print((list(bin(n))))
        return "It's Evil!"


def evil(n):

    one_sum = 0
    while n:
        one_sum += n & 1
        n>>=1

    if one_sum % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"


def evil(n):

    a = bin(n)
    b = list("".join(a[2:]))
    c = sum([int(i) for i in b])

    if c % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"

def countSetBits(n):
    count = 0

    while (n):
        n = n & (n-1)
        count = count + 1

    return count


def evil(n):
    return "It's Odious!" if (countSetBits(n) % 2 == 1) else "It's Evil!"


def evil(n):
    if f"{n:b}".count("1") % 2:
        ret = "Odious"
    else:
        ret = "Evil"
    return f"It's {ret}!"

def evil(n):
    return ["It\'s Odious!", "It\'s Evil!"][str(bin(n)).count('1')%2==0]

def evil(n):
    return ["It's Odious!","It's Evil!"][str(bin(n)).count('1')%2==0]

def evil(n):
    return f"It's {'Odious' if '{0:b}'.format(n).count('1')%2 else 'Evil'}!"

def evil(n):
    binario = bin(n)[2::]
    unos = binario.count("1")
    return "It's Odious!" if unos%2!=0 else "It's Evil!"

def evil(n):
    one_count = bin(n).count("1")
    if one_count % 2 == 0:
        return "It's Evil!"
    else:
        return "It's Odious!"