# sorting medium

Longest Word First

The banner printer wants words biggest-first so the giant letters get ink while it's fresh. 🖨️

You get a list of words. Print them longest first, comma-separated. Words of the same length keep their original order.

Example:

Input: words = ["hi", "dragon", "cat", "elephant"] Output: elephant,dragon,cat,hi

Sorting by length descending (key=len, reverse=True) puts "elephant" (8 letters) first and "hi" (2 letters) last.

💡 need a hint?

sort-longest-word-first.py🔒 given lines are locked — write your code in between
loading...