- 1

What does this code output? letters = ['x', 'y', 'z'] letters.insert(1, 'w') print(letters[2])

pls give the answer

2nd Nov 2020, 5:16 PM
SHUVODEEP LODH
SHUVODEEP LODH - avatar
6 odpowiedzi
+ 2
Hi SHUVODEEP LODH, The variable letters defines a new list containing 3 elements. letters.insert(1, 'w') inserts 'w' at the second place. The last statement prints letters[2], that is, the 3rd element of the list, which will now be y. Next time if you want to find just the output, try using Code Playground... https://code.sololearn.com/cv37USpFF6jx/?ref=app
2nd Nov 2020, 5:31 PM
Rahul Hemdev
Rahul Hemdev - avatar
+ 1
y answer
27th Feb 2021, 6:59 AM
v manojbabu
v manojbabu - avatar
0
The answer to this problem is Y. I hope this is helpful.
15th Dec 2022, 4:33 PM
Shangeeth Jaseeharan
Shangeeth Jaseeharan - avatar
0
What does this code output? letters = ['x', 'y', 'z'] letters.insert(1, 'w') print(letters[2])
15th Feb 2023, 12:00 PM
Madhavan .M
Madhavan .M - avatar
- 5
Run the code in Code Playground and find out for yourself.
2nd Nov 2020, 5:23 PM
Ipang