What is the output of print(list(range(5, 0, -1))) in Python?
print(list(range(5, 0, -1)))
Correct answer
D. [5, 4, 3, 2, 1]
5 views
D. [5, 4, 3, 2, 1]
5 views
A negative step counts downward.
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.