β back to unit
Easy
# searching easy
Shortest Word
The tiniest fairy can only carry the tiniest word. π§
You get a list of words (at least one). Print the word with the fewest letters. On a tie, the first one wins.
Example:
Input: words = ["dragon", "elf", "goblin", "orc"]
Output: elf
Starting with best = "dragon" (6 letters), elf (3 letters) is shorter and becomes the new best β nothing later beats it.
π‘ need a hint?
srch-shortest-word.pyπ given lines are locked β write your code in between
loading...