🚫 Why Using '=' for Variable Copy is a Trap! 💥 #CodingMistakes #ProgrammingTips

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Hey there is a inbuilt list function to copy
b=a.copy()

vbanumathi
Автор

Use string slice
a=[1, 2, 3]
b=a[:]
print(b)
print(id(a))
print(id(b))

Dhanush-cgtf
Автор

Import copy
b =copy.deepcopy(a)
This will create different id for b list

dhilip
Автор

b=[1, 2, 3]
a=[ ]
for i in b:
a.append(i)

ragulp
Автор

Deep copy..i am just starting to learn python.
Your videos are ultimate to understand easily 👍👍

jujiyavudeen
Автор

Bro shallow copy and deep copy pathi video podunga

nauzz
Автор

Bro actually muttable data types ah assignment operator vechi assign pannumbothu mattum tha reference copy agum. Immutable data types like int string ah assign panna fresh copy thaa agum. Check it

SASIKUMARK-leuj
Автор

a = [1, 2, 3]
b = []
For i in a:
B.append(i)

#guess this might work

thejeshm
Автор

Python mattum illa ella program language same

dhinakaransaravanan
Автор

When I was a fresher, it took 2 days for me to debug this 😑😢

raj
Автор

Deep copy Shallow copy learn from class 12 Sumita Aurora Book

navaneeshgalattas
Автор

A=[1, 2, 3]
B=A.copy()
B[1]=4
Print(A) ---> [1, 2, 3]
Print(B) ---> [ 1, 4, 3]

Is this Correct..?

riyasahamed
join shbcf.ru