# Scenario 

*Now that the competition gets tough it will* **_Sort out the men from the boys_** . 

**_Men_** are the **_Even numbers_** and **_Boys_** are the **_odd_**   ![!alt](https://i.imgur.com/mdX8dJP.png) ![!alt](https://i.imgur.com/mdX8dJP.png) 

___
# Task

**_Given_** an *array/list [] of n integers* , **_Separate_** *The even numbers from the odds* , or **_Separate_**  **_the men from the boys_**  ![!alt](https://i.imgur.com/mdX8dJP.png) ![!alt](https://i.imgur.com/mdX8dJP.png)  
___
# Notes

* **_Return_** *an array/list where* **_Even numbers_** **_come first then odds_** 

* Since , **_Men are stronger than Boys_** , *Then* **_Even numbers_** in **_ascending order_** While **_odds in descending_** .

* **_Array/list_** size is *at least **_4_*** .

* **_Array/list_** numbers could be a *mixture of positives , negatives* .

* **_Have no fear_** , *It is guaranteed that no Zeroes will exists* . ![!alt](https://i.imgur.com/mdX8dJP.png)  

* **_Repetition_** of numbers in *the array/list could occur* , So **_(duplications are not included when separating)_**.
____
# Input >> Output Examples:

```
menFromBoys ({7, 3 , 14 , 17}) ==> return ({14, 17, 7, 3}) 
```

## **_Explanation_**:

**_Since_** , `{ 14 }` is the **_even number_** here , So it **_came first_** , **_then_** *the odds in descending order* `{17 , 7 , 3}`  .
____

```
menFromBoys ({-94, -99 , -100 , -99 , -96 , -99 }) ==> return ({-100 , -96 , -94 , -99})
```

## **_Explanation_**:

* **_Since_** , `{ -100, -96 , -94 }` is the **_even numbers_** here , So it **_came first_** in *ascending order *, **_then_** *the odds in descending order* `{ -99 }`

* **_Since_** , **_(Duplications are not included when separating)_** , *then* you can see **_only one (-99)_** *was appeared in the final array/list* . 
____

```
menFromBoys ({49 , 818 , -282 , 900 , 928 , 281 , -282 , -1 }) ==> return ({-282 , 818 , 900 , 928 , 281 , 49 , -1})
```

## **_Explanation_**:

* **_Since_** , `{-282 , 818 , 900 , 928 }` is the **_even numbers_** here , So it **_came first_** in *ascending order* , **_then_** *the odds in descending order* `{ 281 , 49 , -1 }`

* **_Since_** , **_(Duplications are not included when separating)_** , *then* you can see **_only one (-282)_** *was appeared in the final array/list* . 
____
____
___

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [Bizarre Sorting-katas](https://www.codewars.com/collections/bizarre-sorting-katas)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Sorting

Starter code: def men_from_boys(arr):
	

Solutions:
def men_from_boys(arr):
	men = []
	boys = []
	for i in sorted(set(arr)):
		if i % 2 == 0:
			men.append(i)
		else:
			boys.append(i)
	return men + boys[::-1]


def men_from_boys(arr):
	return sorted(set(arr), key=lambda n: (n % 2, n * (-1) ** (n % 2)))


def men_from_boys(arr):
	(odds, evens) = ([], [])
	for x in set(arr):
		[evens, odds][x % 2].append(x)
	return sorted(evens) + sorted(odds)[::-1]


def men_from_boys(arr):
	evens = {x for x in arr if x % 2 == 0}
	odds = {x for x in arr if x % 2 == 1}
	return sorted(list(evens)) + sorted(list(odds), reverse=True)


def men_from_boys(arr):
	arr = list(set(arr))
	return sorted([x for x in arr if x % 2 == 0]) + sorted([x for x in arr if x % 2 != 0], reverse=True)


def men_from_boys(arr):
	sorted_unique_arr = sorted(set(arr))
	(men, boys) = ([], [])
	for d in sorted_unique_arr:
		if d % 2 == 0:
			men = men + [d]
		else:
			boys = [d] + boys
	return men + boys


def men_from_boys(arr):
	(men, boys) = ([], [])
	for v in set(arr):
		if v % 2 == 0:
			men.append(v)
		else:
			boys.append(v)
	return sorted(men) + sorted(boys, reverse=True)


def men_from_boys(arr):
	mens = [x for x in sorted(set(arr)) if x % 2 == 0]
	boys = [x for x in sorted(set(arr), key=lambda n: -n) if x % 2 == 1]
	return mens + boys


def men_from_boys(arr):
	(men, boys) = ([], [])
	for p in sorted(set(arr)):
		if p % 2:
			boys.append(p)
		else:
			men.append(p)
	return men + boys[::-1]


men_from_boys = lambda a: sorted(set(a), key=lambda e: ~(10 ** 3 + e) * (e % 2) or -10 ** 6 + e)


def men_from_boys(arr):
	arr = sorted(set(arr))
	return [i for i in arr if i % 2 == 0] + [i for i in arr[::-1] if i % 2]


def men_from_boys(a):
	x = sorted(filter(lambda _: _ % 2, list(set(a))), reverse=True)
	y = sorted(filter(lambda _: not _ % 2, list(set(a))))
	return y + x


def men_from_boys(arr):
	return list(dict.fromkeys(sorted([num for num in arr if num % 2 == 0]) + sorted([num for num in arr if num % 2 != 0], reverse=True)))


def men_from_boys(arr):
	return sorted(set(arr), key=lambda a: (a % 2, [a, -a][a % 2]))


def men_from_boys(arr):
	L = []
	L1 = []
	for i in arr:
		if i % 2 == 0:
			if i not in L:
				L.append(i)
		elif i not in L1:
			L1.append(i)
	L.sort()
	L1.sort()
	L1 = L1[::-1]
	return L + L1


def men_from_boys(arr):
	return sorted(set(arr), key=lambda i: ~(4 ** 5 + i) * (i % 2) or -5 ** 5 + i)


def men_from_boys(arr):
	(even, odd) = ([], [])
	for num in set(arr):
		if num % 2 == 0:
			even.append(num)
		else:
			odd.append(num)
	return sorted(even) + sorted(odd, reverse=True)


def men_from_boys(arr):
	odd_arr = []
	eve_arr = []
	for i in arr:
		if i % 2 and i not in odd_arr:
			odd_arr.append(i)
		if not i % 2 and i not in eve_arr:
			eve_arr.append(i)
	eve_arr.sort()
	odd_arr.sort(reverse=True)
	return eve_arr + odd_arr


def men_from_boys(arr):
	even = []
	odd = []
	for i in sorted(set(arr)):
		if i % 2 == 0:
			even.append(i)
		else:
			odd.append(i)
	return even + odd[::-1]


def men_from_boys(arr):
	arr.sort()
	print(arr)
	sorted = []
	odds = []
	for num in arr:
		if num % 2 == 0:
			if num not in sorted:
				sorted.append(num)
		elif num not in odds:
			odds.append(num)
	odds.reverse()
	for numb in odds:
		sorted.append(numb)
	return sorted


def men_from_boys(arr):
	arr = list(set(arr))
	a = []
	b = []
	arr.sort()
	for i in range(0, len(arr)):
		if arr[i] % 2 == 0:
			a.append(arr[i])
		else:
			b.insert(0, arr[i])
	return a + b


def men_from_boys(num):
	return sorted(list(set([i for i in num if i % 2 == 0]))) + sorted(list(set([i for i in num if i % 2 != 0])), reverse=True)


def men_from_boys(arr):
	m = []
	b = []
	for i in arr:
		if i % 2 == 0:
			m.append(i)
			m = list(dict.fromkeys(m))
			m.sort()
		else:
			b.append(i)
			b = list(dict.fromkeys(b))
			b.sort(reverse=True)
	return m + b


def men_from_boys(arr):
	odd = []
	even = []
	for i in arr:
		if i % 2 == 0 and i not in even:
			even.append(i)
		elif i % 2 != 0 and i not in odd:
			odd.append(i)
	return sorted(even) + sorted(odd, reverse=True)


def men_from_boys(arr):
	evens = sorted({x for x in arr if not x % 2})
	odds = sorted({x for x in arr if x % 2})[::-1]
	return evens + odds


def men_from_boys(arr):
	return sorted((n for n in set(arr) if not n % 2)) + sorted((n for n in set(arr) if n % 2))[::-1]


def men_from_boys(arr):
	men = [x for x in set(arr) if x % 2 == 0]
	boizz = [x for x in set(arr) if x % 2 != 0]
	return sorted(men) + sorted(boizz, reverse=True)


def men_from_boys(arr):
	l1 = sorted(set(arr))
	(arr, odds) = ([], [])
	for i in l1:
		if i & 1:
			odds.append(i)
		else:
			arr.append(i)
	l1 = None
	odds.reverse()
	arr.extend(odds)
	return arr


def men_from_boys(arr):
	a = []
	b = []
	for x in arr:
		if x % 2 == 0:
			if x not in a:
				a.append(x)
			else:
				continue
		elif x not in b:
			b.append(x)
		else:
			continue
	return sorted(a) + list(reversed(sorted(b[::-1])))


def men_from_boys(arr):
	(odd, even) = ([], [])
	arr = list(set(arr))
	arr.sort()
	for i in arr:
		if i % 2:
			odd.append(i)
		else:
			even.append(i)
	odd.reverse()
	even.extend(odd)
	return even


def men_from_boys(arr):
	even = sorted(filter(lambda x: x % 2 == 0, set(arr)))
	odd = sorted(filter(lambda x: x % 2 == 1, set(arr)), reverse=True)
	even.extend(odd)
	return even


def men_from_boys(arr):
	ascArr = []
	desArr = []
	for x in set(arr):
		ascArr.append(x) if x % 2 == 0 else desArr.append(x)
	return sorted(ascArr) + sorted(desArr, reverse=True)


def men_from_boys(arr):
	mens = sorted([x for x in set(arr) if x % 2 == 0])
	boys = sorted([x for x in set(arr) if x % 2 == 1], reverse=True)
	return list(mens + boys)


def men_from_boys(arr):
	(E, U) = (set(), set())
	for n in arr:
		U.add(n) if n % 2 else E.add(n)
	return sorted(E) + sorted(U, reverse=True)


def men_from_boys(arr):
	men = [_ for _ in set(arr) if _ % 2 == 0]
	men = sorted(men)
	boys = [_ for _ in set(arr) if _ % 2 != 0]
	boys = sorted(boys)
	boys.reverse()
	res = []
	return men + boys


def men_from_boys(arr):
	evens = [i for i in arr if i % 2 == 0]
	odds = [i for i in arr if i % 2 != 0]
	a = list(set(evens))
	b = list(set(odds))
	a.sort()
	b.sort(reverse=True)
	return a + b


def men_from_boys(arr):
	return sorted(set(arr), key=lambda x: (x % 2 != 0, 0 - x if x % 2 else x))


def men_from_boys(arr):
	arr = list(set(arr))
	men = [i for i in arr if i % 2 == 0]
	boys = [i for i in arr if i % 2 == 1]
	men = sorted(men)
	boys = sorted(boys, reverse=True)
	return men + boys


def men_from_boys(arr):
	x = set([a for a in arr if a % 2 == 0])
	y = set([b for b in arr if b % 2 != 0])
	z1 = sorted(y, reverse=True)
	z2 = sorted(x, reverse=False)
	return z2 + z1


def men_from_boys(arr):
	arr = list(dict.fromkeys(arr))
	men = []
	boys = []
	for i in arr:
		if i % 2 == 0:
			men.append(i)
		else:
			boys.append(i)
	men.sort()
	boys.sort(reverse=True)
	return men + boys


def men_from_boys(arr):
	(a, b) = (filter(lambda x: x % 2 == 0, arr), filter(lambda x: x % 2 == 1, arr))
	return sorted(list(set(a))) + sorted(list(set(b)), reverse=True)


def men_from_boys(arr):
	odd = []
	even = []
	for i in range(len(arr)):
		if arr[i] % 2 == 1 and arr[i] not in odd:
			odd.append(arr[i])
		elif arr[i] % 2 == 0 and arr[i] not in even:
			even.append(arr[i])
	final_odd = sorted(odd, reverse=True)
	final_even = sorted(even)
	output = final_even + final_odd
	return output


def men_from_boys(arr):
	arr = set(arr)
	return sorted([i for i in arr if not i % 2]) + sorted([i for i in arr if i % 2], reverse=True)


def men_from_boys(x):
	return sorted(set([i for i in x if i % 2 == 0])) + sorted(set([i for i in x if i % 2 != 0]), reverse=True)


def men_from_boys(arr):
	return sorted([el for el in set(arr) if el % 2 == 0]) + sorted([el for el in set(arr) if el % 2 == 1], key=lambda el: -el)


def men_from_boys(A):
	return sorted((e for e in set(A) if not e % 2)) + sorted((e for e in set(A) if e % 2), reverse=True)


def men_from_boys(arr):
	men = [n for n in arr if n % 2 == 0]
	boys = [n for n in arr if n % 2 != 0]
	m = []
	b = []
	for n in men:
		if n not in m:
			m.append(n)
	for n in boys:
		if n not in b:
			b.append(n)
	m.sort()
	b.sort(reverse=True)
	return m + b


def men_from_boys(arr):
	dummy = []
	dummy1 = []
	for i in sorted(set(arr)):
		if i % 2 == 0:
			dummy.append(i)
		else:
			dummy1.append(i)
	dummy.extend(dummy1[::-1])
	return dummy


men_from_boys = lambda a: sorted(set((x for x in a if x % 2 == 0))) + sorted(set((x for x in a if x % 2 == 1)), reverse=True)


def men_from_boys(arr):
	o = [x for x in arr if x % 2 == 1]
	e = [x for x in arr if x % 2 == 0]
	o = list(set(o))
	e = list(set(e))
	o.sort(reverse=True)
	e.sort()
	return e + o


def men_from_boys(arr):
	even = []
	odd = []
	for a in arr:
		if a % 2 == 0:
			if a not in even:
				even.append(a)
		elif a not in odd:
			odd.append(a)
	print(even)
	print(odd)
	odd.sort(reverse=True)
	even.sort()
	for o in odd:
		even.append(o)
	return even


def men_from_boys(arr):
	boysodd = []
	meneven = []
	for number in arr:
		if number % 2 == 0 and number not in meneven:
			meneven.append(number)
		elif number % 2 != 0 and number not in boysodd:
			boysodd.append(number)
	a = sorted(meneven) + sorted(boysodd, reverse=True)
	return a


def men_from_boys(arr):
	distinct = set(arr)
	men = sorted((m for m in distinct if m % 2 == 0))
	boys = sorted((b for b in distinct if b % 2), reverse=True)
	return men + boys


def men_from_boys(arr):
	men = [x for x in arr if not x % 2]
	boys = [x for x in arr if x % 2]
	return sorted(set(men)) + sorted(set(boys), reverse=True)


def men_from_boys(a):
	return sorted({x for x in a if x % 2 == 0}) + sorted({x for x in a if x % 2 != 0}, reverse=True)


def men_from_boys(arr):
	return [*dict.fromkeys(sorted(filter(lambda x: x % 2 == 0, arr)) + sorted(filter(lambda x: x % 2, arr), reverse=True)).keys()]


def men_from_boys(arr):
	men_list = sorted((i for i in arr if i % 2 == 0))
	boy_list = sorted((i for i in arr if i % 2 != 0))
	return list(dict.fromkeys(men_list + boy_list[::-1]))


def men_from_boys(arr):
	evens = []
	odds = []
	for num in arr:
		if num % 2 == 0:
			evens.append(num)
		if num % 2 == 1:
			odds.append(num)
	return sorted(set(evens)) + sorted(set(odds), reverse=True)


def men_from_boys(arr):
	even = []
	odds = []
	for i in set(arr):
		if i % 2:
			odds.append(i)
		else:
			even.append(i)
	return sorted(even) + sorted(odds, reverse=True)


def men_from_boys(arr):
	men = []
	boy = []
	for el in arr:
		if el % 2 == 0 and el not in men:
			men.append(el)
		elif el % 2 != 0 and el not in boy:
			boy.append(el)
	return sorted(men) + sorted(boy, reverse=True)


def men_from_boys(arr):
	man = []
	boy = []
	for x in set(arr):
		if x % 2 == 0:
			man.append(x)
		if x % 2 == 1:
			boy.append(x)
	return sorted(man) + sorted(boy, reverse=True)


def men_from_boys(arr):
	l1 = []
	l2 = []
	for i in sorted(set(arr)):
		if i % 2 == 0:
			l1.append(i)
		else:
			l2.append(i)
	return l1 + l2[::-1]


def men_from_boys(arr):
	m = []
	b = []
	for i in arr:
		if i % 2 == 0:
			if i not in m:
				m.append(i)
		elif i not in b:
			b.append(i)
	m.sort()
	b.sort(reverse=True)
	for i in b:
		m.append(i)
	return m


def men_from_boys(arr):
	s = set(arr)
	even = [x for x in s if x % 2 == 0]
	odd = [x for x in s if x % 2 != 0]
	return sorted(even) + sorted(odd, reverse=True)


def men_from_boys(arr):
	even = list()
	odd = list()
	for k in arr:
		if k % 2 == 0:
			if k in even:
				continue
			even.append(k)
		else:
			if k in odd:
				continue
			odd.append(k)
	even.sort()
	odd.sort(reverse=True)
	new = even + odd
	return new


def men_from_boys(arr):
	even_men = []
	odd_boys = []
	boys_men = []
	for number in arr:
		if number % 2 == 0:
			even_men.append(number)
		else:
			odd_boys.append(number)
	even_men = set(even_men)
	odd_boys = set(odd_boys)
	even_men = list(even_men)
	odd_boys = list(odd_boys)
	even_men.sort()
	odd_boys.sort(reverse=True)
	for number in even_men:
		boys_men.append(number)
	for number in odd_boys:
		boys_men.append(number)
	return boys_men


def men_from_boys(arr):
	boys = []
	men = []
	for elem in set(arr):
		if elem % 2:
			boys.append(elem)
		else:
			men.append(elem)
	return sorted(men) + sorted(boys, reverse=True)


def men_from_boys(arr):
	m = [i for i in arr if i % 2 == 0]
	b = [i for i in arr if i % 2 != 0]
	s1 = set(m)
	s2 = set(b)
	return sorted(s1) + sorted(s2, reverse=True)


def men_from_boys(arr):
	x = [x for x in arr if x % 2 == 0]
	y = [x for x in arr if x % 2 != 0]
	a = list(set(x))
	b = list(set(y))
	b.sort(reverse=True)
	a.sort()
	return a + b


def men_from_boys(arr):
	men = sorted(set([x for x in arr if x % 2 == 0]))
	boys = sorted(set([x for x in arr if x % 2 == 1]), reverse=True)
	return men + boys


def men_from_boys(arr):
	unique = [arr[i] for i in range(len(arr)) if arr[i] not in set(arr[i + 1:])]
	evenL = [n for n in unique if n % 2 == 0]
	evenL.sort()
	oddL = [n for n in unique if n not in evenL]
	oddL.sort()
	oddL.reverse()
	return evenL + oddL


def men_from_boys(arr):
	men = sorted(list(dict.fromkeys([x for x in arr if x % 2 == 0])))
	boys = sorted(list(dict.fromkeys([x for x in arr if x % 2 != 0])), reverse=True)
	return men + boys


def men_from_boys(arr):
	m = list(set([i for i in arr if i % 2 == 0]))
	m.sort()
	n = list(set([i for i in arr if i % 2]))
	n.sort(reverse=True)
	return m + n


def men_from_boys(arr):
	men = []
	boys = []
	for i in arr:
		if i % 2 == 0 and i not in men:
			men.append(i)
		if i % 2 != 0 and i not in boys:
			boys.append(i)
	men.sort()
	boys.sort()
	boys.reverse()
	return men + boys


def men_from_boys(arr):
	evens = []
	odds = []
	for i in arr:
		if i % 2 == 0 and i not in evens:
			evens.append(i)
		if i % 2 != 0 and i not in odds:
			odds.append(i)
	evens.sort()
	odds.sort()
	odds.reverse()
	return evens + odds


def men_from_boys(arr):
	return sorted(set((m for m in arr if m % 2 == 0))) + sorted(set((b for b in arr if b % 2)))[::-1]


def men_from_boys(a):
	men = sorted([x for x in set(a) if x % 2 == 0])
	boys = sorted([x for x in set(a) if x % 2 != 0])[::-1]
	return men + boys


def men_from_boys(arr):
	arr = sorted(set(arr))
	a = [x for x in arr if x % 2 == 0]
	b = sorted([x for x in arr if x % 2 == 1], reverse=True)
	return a + b


def men_from_boys(arr):
	return sorted((v for v in set(arr) if v % 2 == 0)) + sorted((v for v in set(arr) if v % 2), reverse=True)


def men_from_boys(arr):
	chad = sorted([x for x in list(dict.fromkeys(arr)) if x % 2 == 0])
	virgin = sorted([x for x in list(dict.fromkeys(arr)) if x % 2 == 1], reverse=True)
	return chad + virgin


def men_from_boys(arr):
	even_arr = []
	odd_arr = []
	for number in arr:
		if number % 2 == 0:
			even_arr.append(number)
		else:
			odd_arr.append(number)
	even_arr.sort()
	odd_arr.sort()
	odd_arr.reverse()
	result = []
	for number in even_arr:
		if number not in result:
			result.append(number)
	for number in odd_arr:
		if number not in result:
			result.append(number)
	return result


def men_from_boys(arr):
	men = set([h for h in arr if h % 2 == 0])
	boys = set(arr) - set(men)
	return sorted(men) + sorted(boys, reverse=True)