- 2
stuck in python
What does this code output? letters = ['x', 'y', 'z'] letters.insert(1, 'w') print(letters[2])
6 ответов
+ 6
Y
+ 4
When you insert 'w' to the index 1, the list becomes:
x, w, y, z.
So y is at index of 2, so the output is y.
Remember the index starts at 0.
+ 3
Oups. Typo. Thanks!
+ 2
ok
+ 2
the answer is Y
+ 2
y