liveBook · Manning

Sorted

sorted is a Python built-in function that returns a new list containing an iterable’s elements in sorted order without modifying the original iterable.

How 5 Manning books explain it

Python Workout: 50 ten-minute exercises

sorted is a Python built-in function that returns the elements of an iterable in sorted order as a new list.

How it is used
Uses sorted to order characters, sequences, records, and other iterable data while producing a separate list.
How deep it goes
Explains returned-list behavior and key-based ordering with exercises, but stops short of sorting algorithm internals.
Examples
Demonstrates sorted characters, alphabetized names, phone-book dictionaries, database-style tuples, and derived ordering criteria.
What you can do after
Apply it via Python’s built-in sorted to order iterable data and design custom key functions for multi-field or derived criteria.

Read how Python Workout: 50 ten-minute exercises explains sorted →

Python Workout, Second Edition

sorted is a Python built-in function that returns a new list containing the items from an iterable in sorted order.

How it is used
Sorts iterable elements while supporting derived comparison keys for strings, collections, and structured records.
How deep it goes
Explains return types and key-call behavior through worked string, list, tuple, and dictionary examples, without implementation internals.
Examples
Uses sorted characters, variable-length strings, country dictionaries, and database-style tuples as practice data.
What you can do after
Apply sorted to iterable data, reconstruct strings with join, and order records through named or inline key functions.

Read how Python Workout, Second Edition explains sorted →

Tiny Python Projects: Learn coding and testing with puzzles and games

sorted is a Python built-in function that returns a new list containing the sorted elements of an iterable without modifying the original.

How it is used
Uses sorted() to order picnic items or stabilize a word collection before random sampling.
How deep it goes
Distinguishes returned lists from in-place mutation, demonstrates numeric and mixed-type behavior, and stops short of advanced sorting arguments.
Examples
Demonstrates picnic-item sorting, REPL list comparisons, numeric ordering, password-word preparation, and test-driven command-line work.
What you can do after
Apply sorted() to preserve input data, order command-line items, and make set-based random sampling deterministic for tests.

Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains sorted →

Get Programming: Learn to code with Python

A Python built-in function that returns a new list containing the items of an iterable in sorted order.

How it is used
Preserves an original list while producing a sorted list for later use.
How deep it goes
Demonstrates the return value and contrasts copying with in-place sorting, without discussing sorting internals.
Examples
Uses a kid_ages list to show sorted output alongside the unchanged original.
What you can do after
Apply sorted to create an ordered list without modifying the source list.

Read how Get Programming: Learn to code with Python explains sorted →

The Quick Python Book, Fourth Edition

sorted is a Python built-in function that returns a new list containing the items of an iterable in sorted order.

How it is used
Sorts any iterable into a new list when preserving the input or ordering dictionary keys and other non-list iterables matters.
How deep it goes
Explains return behavior, ordering options, comparison rules, custom keys, and memory trade-offs without descending into sorting internals.
Examples
Uses tuples, text lines, nested lists, mixed types, case-insensitive keys, sliced keys, and temperature-median calculations.
What you can do after
Apply it via Python to create sorted copies, reverse results, customize comparisons, and choose between memory-preserving and in-place alternatives.

Read how The Quick Python Book, Fourth Edition explains sorted →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.