← Back to challenges

Return the Four Letter Strings

PythonHardstringsarraysvalidationconditions

Instructions

Create a function that takes a list of strings and returns the words that are exactly four letters.

Examples

is_four_letters(["Tomato", "Potato", "Pair"]) ➞ ["Pair"]

is_four_letters(["Kangaroo", "Bear", "Fox"]) ➞ ["Bear"]

is_four_letters(["Ryan", "Kieran", "Jason", "Matt"]) ➞ ["Ryan", "Matt"]

Notes

You can expect valid strings for all test cases.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Count Ones in a 2D Array