sorted()
Built-in FunctionPython 2.4+Beginner
Returns a new sorted list from any iterable
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.4+
Learn by Difficulty
Quick Example
python
print(sorted([3, 1, 4, 1, 5])) print(sorted("python")) print(sorted([3, 1, 4], reverse=True))
sorted() is a built-in function that returns a new sorted list from any iterable.
Try in PlaygroundTags
builtinfunctioncoresortingsequencefunctional-programming