Understanding sorted() and sort() in Python
This is a medium-difficulty multiple-choice question that tests your grasp of Python's two primary sorting mechanisms. While both accomplish similar goals, they differ in subtle but important ways—distinctions that matter when writing efficient, correct code under time pressure.
The question asks you to identify which statement does not represent a genuine difference between the two functions. To answer it well, you need to understand not just what each does, but the precise trade-offs between them: how they handle mutability, return values, memory use, and which data types they work on. Candidates often confuse surface-level similarities with deeper implementation details.
- Mutability and in-place modification
- Return values and chaining
- Performance and memory footprint
- Applicability to different iterable types