Interview Q&A / Python
Python interview questions
Lists, dictionaries, generators, decorators and the Python questions asked in service-company and data roles.
Prefer rapid revision? Practise Python short interview answers →
- What does range() return in Python 3, and is it a list?
range() returns a lazy range object, not a list. It stores only start, stop and step, so range(10**9) takes tiny memory, supports indexing, len() and the in operator, and produces numbers only when asked.
BeginnerQuick answer1 min read