Hackbright Code Challenges

Longest Word

Longest Word

Whiteboard

Easier

Concepts

Strings, Lists

Download

longest-word.zip

Solution

Longest Word: Solution


Write a function, find_longest_word, that takes a list of words and returns the length of the longest one.

>>> find_longest_word(["hi", "hello"])
5

>>> find_longest_word(["Balloonicorn", "Hackbright"])
12

We’ve given you longest-word.py, which includes the stub of a find_longest_word function:

longest-word.py
def find_longest_word(words):
    """Return longest word in list of words."""