← back to unit
Easy
# breaking it down easy
Word Stats Machine
Feed it a sentence, and the machine spits out the vital statistics. 🖥️
You get a sentence of space-separated words. Print three lines: words <count>, longest <word>, shortest <word> (first on any ties).
Example:
Input: sentence = "the dragon ate my homework"
Output:
words 5
longest homework
shortest my
There are 5 words. "homework" (8 letters) is the longest, and "my" (2 letters) is the shortest.
💡 need a hint?
brk-word-stats.py🔒 given lines are locked — write your code in between
loading...