Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
list_copy_shallow_deep.py
#python 3.5.2 #Deep copy thislist = ["apple", "banana", "cherry"] mylist = thislist.copy() print(mylist) thislist[0]=12#only thislist gets affected print(thislist) print(mylist) print(id(thislist) is id(mylist)) #Deep copy thislist = ["apple", "banana", "cherry"] mylist = list(thislist) print(mylist) thislist[0]=12#only thislist gets affected print(thislist) print(mylist) print(id(thislist) is id(mylist)) #shallow copy thislist = ["apple", "banana", "cherry"] mylist=thislist print(mylist) thislist[0]=12#both lists get affected print(thislist) print(mylist) print(id(thislist) is id(mylist))
run
|
edit
|
history
|
help
0
isPalindrome.py
Ej2_python_204676887
CICLO WHILE PYTHON 3
Ваня и забор
jhjhh
Breadth-First Path Finding
Reading XML file for modification
Metric failed
restraunt score
queue and stack