Soru
What will the following code output? my_(-)list=[1,2,3] my_list[1] = 2 print(my list) [1,2,3] [1,20,3] Error [20,2,3]
Çözüm
4.4
(120 Oylar)
Cenk
Kıdemli · 9 yıl öğretmeni
Uzman doğrulaması
Cevap
The code will output an error. The reason is that the variable name in the second line of the code is incorrect. It should be `my_list` instead of `my_{-}list`. Therefore, the correct code should be:```pythonmy_list = [1, 2, 3]my_list[1] = 2print(my_list)```The output of this code will be:```python[1, 2, 3]```