Range Function
Multiple Choice Easy
Question
What does list(range(2, 10, 2)) produce?
Hint
range(start, stop, step) excludes stop.
Explanation
list(range(2, 10, 2)) produces [2, 4, 6, 8]. range generates numbers from start (inclusive) to stop (exclusive) with the given step. 2, 4, 6, 8 — 10 is excluded. range is lazy (produces values on demand), so list() is needed to see all values. range(n) gives 0 to n-1, range(a, b) gives a to b-1.
Related Resources
Related Lessons
- Conditions & Loops
Learn conditions and loops.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.