# Find parity outliers

Finds the items that are parity outliers in a given list.

• Use `collections.Counter` with a list comprehension to count even and odd values in the list.
• Use `collections.Counter.most_common()` to get the most common parity.
• Use a list comprehension to find all elements that do not match the most common parity.
```from collections import Counter

def find_parity_outliers(nums):
return [
x for x in nums
if x % 2 != Counter([n % 2 for n in nums]).most_common()[0][0]
]

find_parity_outliers([1, 2, 3, 4, 6]) # [1, 3]```

## More like this

• Collection · 37 snippets

### Python Math

Learn how to perform common mathematical operations in Python 3.6 with this snippet collection.

• Python ·

### Find all matching indexes

Finds the indexes of all elements in the given list that satisfy the provided testing function.

• Python ·

### Find matching index

Finds the index of the first element in the given list that satisfies the provided testing function.

• Python ·

### Find last matching index

Finds the index of the last element in the given list that satisfies the provided testing function.

Start typing a keyphrase to see matching snippets.