Step-by-Step Execution
✅ range(3) generates:
0, 1, 2✅ Initial value:
x = 0
🔁 Loop Iterations:
➤ 1st Iteration:
➤ 2nd Iteration:
➤ 3rd Iteration:
✅ After the Loop Ends
i remains stored as the last value → 2
x = 3
✅ Final Output:
2 3Important Concept (Interview Tricky Point)
✅ In Python, loop variables (i) stay alive after the loop ends, unlike some other languages.















