← Back to challenges

Which Number Is Not like the Others?

PythonHardnumbersarraysalgorithms

Instructions

Create a function that takes a list of numbers and returns the number that's unique.

Examples

unique([3, 3, 3, 7, 3, 3]) ➞ 7

unique([0, 0, 0.77, 0, 0]) ➞ 0.77

unique([0, 1, 1, 1, 1, 1, 1, 1]) ➞ 0

Notes

Test cases will always have exactly one unique number while all others are the same.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Sum of Two Digit Numbers