What is the output of the following Python code snippet?
for i in range(2):
print(i)
print(i)
Correct answer
A. 0 1
5 views
A. 0 1
5 views
range(2) gives 0 and 1.
Asked in: Python Interview Control Flow
https://docs.python.org/3/tutorial/controlflow.htmlNot sure why the answer is A? Ask here and get an explanation.