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]](https://static.questionai.com.tr/resource%2Fqaiseoimg%2F202412%2Ffollowing-code-outputmylist123mylist1-2printmy-tZ74QDXef70V.jpg?x-oss-process=image/resize,w_600,h_600/quality,q_50/format,webp)
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.4120 Voting

Cenk
Kıdemli · 9 yıl öğretmeniUzman 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:
```python
my_list = [1, 2, 3]
my_list[1] = 2
print(my_list)
```
The output of this code will be:
```python
[1, 2, 3]
```
```python
my_list = [1, 2, 3]
my_list[1] = 2
print(my_list)
```
The output of this code will be:
```python
[1, 2, 3]
```
Derecelendirmek için tıklayın: