What is the output of the following Python code snippet?
for i in range(5):
pass
print(i)
pass
print(i)
Correct answer
A. 4
6 views
A. 4
6 views
A for loop variable remains defined after the loop ends.
Asked in: Python Interview Output Prediction
https://docs.python.org/3/reference/datamodel.htmlNot sure why the answer is A? Ask here and get an explanation.