What is the output of print(list(range(2, 8, 2))) in Python?
print(list(range(2, 8, 2)))
Correct answer
D. [2, 4, 6]
8 views
D. [2, 4, 6]
8 views
range(start, stop, step) stops before reaching stop.
Asked in: Python Interview Control Flow
https://docs.python.org/3/tutorial/controlflow.htmlNot sure why the answer is D? Ask here and get an explanation.