Question DSA-TP-0020
MediumWhat is the output of this code?
a = [1, 2, 3, 4, 5]
i, j = 0, len(a) - 1
while i < j:
a[i], a[j] = a[j], a[i]
i += 1
j -= 1
print(a)
- A.
[1, 2, 3, 4, 5]
- B.
[1, 4, 3, 2, 5]
- C.
Sign up free to see the answer and a step-by-step explanation.