+ 7
append method in Python..
in the code.. list1=[1,2,3,4] list2=list1 list1.append(5) print(list2) OUTPUT: [1,2,3,4,5] why the changes made in list1 is reflected to list2 ? (is it like in c++ we work with addresses ?)
2 ответов
+ 1
because list2 ist the same as list1 just with another name
+ 1
If u made changes in the list1 it also make changes to list 2