How does the Python's range function work?
Python's range() returns an immutable sequence object (an iterable) rather than a list. It generates numbers on demand using lazy evaluation, calculating each value only when needed based on its stored start, stop, and step parameters. Because it only stores these three integers, it maintains a constant memory…
Answered Dec 19, 2025 · 881 Views Read answer →