← Back to challenges

Outlier Number

PythonHardarraysnumbersmath

Instructions

Given a list of either entirely odd integers or entirely even integers except for a single Outlier Number, create a function to return this number.

Examples

outlier_number([2, 3, 4]) ➞ 3
# 2 and 4 are even numbers.
# 3 is an outlier number.

outlier_number([1, 2, 3]) ➞ 2

outlier_number([4, 1, 3, 5, 9]) ➞ 4

Notes

List size will always be >= 3.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Sum of Even Pairs in List