What does the following produce? for a[0] in a: print a = [0, 1, 2, 3]. (a[0])
A. 3-3-3-3
B. 0 1 2 2
C. 0 1 2 3
D. a mistake
Answer:C
What does the following produce? for a[0] in a: print a = [0, 1, 2, 3]. (a[0])
A. 3-3-3-3 B. 0 1 2 2 C. 0 1 2 3 D. a mistake
Explanation: In each repetition, the value of a[0] shifts. There is no evident problem in the current example because the first value it accepts is itself.