

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Recursion
incomplete
2: Recursion Review
incomplete
3: Zipmap
incomplete
4: Recursion Quiz
incomplete
5: Nested Sum
incomplete
6: Recursion Review
incomplete
7: Recursion on a Tree
incomplete
8: Dangers of Recursion
incomplete
9: Recursion Practice
incomplete
10: Recursion Practice
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
In Doc2Doc, we have a search function to find the longest word in a document.
Complete the find_longest_word function without a loop. It accepts two string inputs, document and (optionally) longest_word, which is the current longest word and defaults to an empty string.
You can use .split with maxsplit=1 to split a string into a list of [first_word, rest_of_string].
Assume that a "word" means any series of consecutive non-whitespace characters. For example, find_longest_word("How are you?") should return the string "you?".
Review the provided tests in main_test.py to see the expected behavior, including edge cases.