0
Python code problem
I only changed the value of list "b" but list "a" is also changed. Please have a look at my code. https://code.sololearn.com/cGVTfZ2K2xZC/?ref=app
4 Respuestas
+ 5
because b is just a reference to a. they have the same id
https://code.sololearn.com/cfKSp5iu9iPX/?ref=app
try:
Gajendra Sonare b = list(a) # instead of b = a
+ 2
Slick Got it!😄
+ 2
Wanna get same but independent list?
l = [1,2,3,4]
l2=l.copy()
- 1
س