Feb-06-2022, 08:05 PM
(This post was last modified: Feb-06-2022, 08:05 PM by deanhystad.)
Because sorted takes an iterable argument and returns a list. It doesn't care about the type of the argument as long it is iterable.
From the documents: https://docs.python.org/3/library/functions.html#sorted
From the documents: https://docs.python.org/3/library/functions.html#sorted
Quote:sorted(iterable, /, *, key=None, reverse=False)
Return a new sorted list from the items in iterable.