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: EASY
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):
	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]}!"


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):
	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):
	n = (n & 6148914691236517205) + (n >> 1 & 6148914691236517205)
	n = (n & 3689348814741910323) + (n >> 2 & 3689348814741910323)
	n = (n & 1085102592571150095) + (n >> 4 & 1085102592571150095)
	n = (n & 71777214294589695) + (n >> 8 & 71777214294589695)
	n = (n & 281470681808895) + (n >> 16 & 281470681808895)
	n = (n & 4294967295) + (n >> 32 & 4294967295)
	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(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])


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: int) -> str:
	return f"It's {('Odious' if str(bin(n)).count('1') % 2 else 'Evil')}!"


evil = lambda n: "It's Odious!" if bin(n).count('1') % 2 else "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):
	_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):
	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)


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):
	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):
	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 sum([int(i) for i in list(bin(n))[2:]]) % 2 == 0 else "It's Odious!"


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):
	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):
	b = format(n, 'b')
	if b.count('1') % 2 == 0:
		return "It's Evil!"
	else:
		return "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 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):
	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):
	s = []
	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]
	binary = ''
	for n in s_reverse:
		binary += str(n)
	count = 0
	for s in binary:
		if s == '1':
			count += 1
	if count % 2 == 0:
		return "It's Evil!"
	else:
		return "It's Odious!"


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):
	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):
	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):
	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 evil(n):
	if f'{n:b}'.count('1') % 2:
		ret = 'Odious'
	else:
		ret = 'Evil'
	return f"It's {ret}!"