Post

Kode Gurukul
Kode Gurukul@kodegurukul·
@Python_Dv Answer is B) [4,2,3] Here's the Explanation: 1⃣ Initially, x is assigned a list [1, 2, 3]. 2⃣ Now, y = x, means y is assigned the same reference that x holds. y is not a copy of x, instead, both x and y point to the same list object in memory.
English
2
0
6
442
Rakesh Das
Rakesh Das@RakeshDas_18·
@Python_Dv B. [4, 2, 3] is the answer. Explanation: When y is assigned x, it refers to the same list object as x. Modifying y also modifies x because they point to the same list in memory. So, changing y[0] to 4 modify x as well. Therefore, [4, 2, 3] is the output.
English
0
0
4
320
¯\_(ツ)_/¯
¯\_(ツ)_/¯@PootSoHard·
@Python_Dv B. X and Y point to the same location in memory. Changing one changes both.
English
0
0
1
209
Michiharu Takemoto
Michiharu Takemoto@mtakemoto·
@Python_Dv B) [4,2,3] Variables do not hold data themselves but are merely references (names) to the data. Therefore, y = x simply means that y is assigned the reference point of the list x. Consequently, y[0] = 4 just sets the first element of that referenced data to the literal 4.
English
0
0
1
258
Pradyumn Panicker
Pradyumn Panicker@PradyumPanicker·
@Python_Dv Option B) because in python the counting always starts from 0 ,So 1 was replaced by 4.
English
0
0
0
2
PyYAWN
PyYAWN@PyYawn84700·
@Python_Dv B y is equal to x which is equal to 1 2 3 but the start of the list is changed to 4.
English
0
0
0
6
Prem Prakash
Prem Prakash@4EverPrem·
@Python_Dv B. Both x and y refer to the same memory object. It can be checked using print(id(x)) print(id(y)) Therefore, when y is changed, x is also changed.
English
0
0
0
233
S Abdul
S Abdul@S_Abdul06·
@Python_Dv B. The list items for X is replaced as y....and the first item which "1" here is the denoted as [0] as we all know that in python we start counting from 0 .....Soo "1" will be replaced by "4" in the final statement.....so the output will be [4, 2, 3]
English
0
0
2
162
Paylaş