← Back to challenges

Odd One Out

PythonHardarraysvalidation

Instructions

Write a function that returns True if exactly one word in the list differs in length from the rest. Return False in all other cases.

Examples

odd_one_out(["silly", "mom", "let", "the"]) ➞ True

odd_one_out(["swanky", "rhino", "moment"]) ➞ True

odd_one_out(["the", "them", "theme"]) ➞ False

odd_one_out(["very", "to", "an", "some"]) ➞ False

Notes

The length of the list will always have at least three or more words.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.