The town sheriff dislikes odd numbers and wants all odd numbered families out of town! In town crowds can form and individuals are often mixed with other people and families. However you can distinguish the family they belong to by the number on the shirts they wear. As the sheriff's assistant it's your job to find all the odd numbered families and remove them from the town!
~~~if-not:cpp
Challenge: You are given a list of numbers. The numbers each repeat a certain number of times. Remove all numbers that repeat an odd number of times while keeping everything else the same.
~~~
~~~if:cpp
Challenge: You are given a vector of numbers. The numbers each repeat a certain number of times. Remove all numbers that repeat an odd number of times while keeping everything else the same.
~~~
```python
odd_ones_out([1, 2, 3, 1, 3, 3]) = [1, 1]
```
In the above example:
- the number 1 appears twice
- the number 2 appears once
- the number 3 appears three times

`2` and `3` both appear an odd number of times, so they are removed from the list. The final result is: `[1,1]`

Here are more examples:
```python
odd_ones_out([1, 1, 2, 2, 3, 3, 3]) = [1, 1, 2, 2]
odd_ones_out([26, 23, 24, 17, 23, 24, 23, 26]) = [26, 24, 24, 26]
odd_ones_out([1, 2, 3]) = []
odd_ones_out([1]) = []
```

Are you up to the challenge?

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def odd_ones_out(numbers):
	

Solutions:
def odd_ones_out(numbers):
	return [i for i in numbers if numbers.count(i) % 2 == 0]


from collections import Counter

def odd_ones_out(numbers):
	cnt = Counter(numbers)
	return [v for v in numbers if not cnt[v] & 1]


def odd_ones_out(numbers):
	temp = []
	count = 0
	for i in range(len(numbers)):
		count = numbers.count(numbers[i])
		if count % 2 == 0:
			temp.append(numbers[i])
	return temp


from collections import Counter

def odd_ones_out(a):
	d = Counter(a)
	return [x for x in a if not d[x] % 2]


from collections import Counter

def odd_ones_out(numbers):
	return [x for x in numbers if x in [k for (k, v) in Counter(numbers).items() if v % 2 == 0]]


def odd_ones_out(numbers):
	dup = 0
	sec = list(set(numbers))
	for i in range(0, len(sec)):
		dup = 0
		for j in range(0, len(numbers)):
			if sec[i] == numbers[j]:
				dup = dup + 1
		if dup % 2 == 1:
			numbers = [value for value in numbers if value != sec[i]]
	return numbers


from collections import Counter

def odd_ones_out(numbers):
	dct = Counter(numbers)
	return [num for num in numbers if dct[num] % 2 == 0]


def odd_ones_out(numbers):
	temp = []
	for num in numbers:
		if numbers.count(num) % 2 == 0:
			temp.append(num)
	return temp


def odd_ones_out(numbers):
	return list(filter(lambda x: not numbers.count(x) % 2, numbers))


from collections import Counter

def odd_ones_out(numbers):
	c = Counter(numbers)
	return [n for n in numbers if c[n] % 2 == 0]