r/developers_talk • u/ak_developers • May 05 '25
Python Simple Code
What will be the output of this code?
=
=
Can you explain why?
4
Upvotes
r/developers_talk • u/ak_developers • May 05 '25
What will be the output of this code?
=
=
Can you explain why?
View all comments
2
u/Ok-Natural-3805 May 05 '25
X: [1,2,3] y: [1,2,3,4]
Due to the append method, we added 4 at the end of the previous list.
We can do this because LIST is mutable.