← back to unit
Easy
# sorting easy
Alphabetical Shelf Check
The dictionary section must be alphabetical, or the librarian loses sleep. 😴
You get the shelf as a list of words. Print perfect if they're in alphabetical order (repeats allowed), otherwise reshelve.
Example:
Input: words = ["ant", "bear", "cat"]
Output: perfect
"ant" < "bear" < "cat" alphabetically, so nothing's out of place — print perfect.
💡 need a hint?
sort-alphabetical-shelf.py🔒 given lines are locked — write your code in between
loading...