Sir, teaching the concept of memory allocation and reference variable is very good, but there is a difference between copy using assignment operator, copy using copy function, in copy using assignment opr. is pure reference (alias), hence both variables will reflect changes, but if you use copy method, say - list = [12,13,14], then mylist=copy.copy(list) , so far the address (id) of each element will be same of both list and mylist, but as soon you do mylist[1] = 34 , then the addresses of [0] and [2] will remain same in both but address of list[1] and mylist[1] will show different ids. In case of nested list its working, same as your demo, Thanks for replying to comment, I will play your next video
@Codeyug10 ай бұрын
I have covered in part 2 of the same concept I guess
@shitalpawar828 Жыл бұрын
Aapke video bahot hi useful hai thank you so much Sir
@Codeyug Жыл бұрын
Thanks for comment
@bidhanry974010 ай бұрын
one more thing we need to know is that - origial_list = ['a', [1,2], [3,4]] copied_list = copy.copy(original_list) in this case if we print both the list, we will get same output, now copied_list[0] = 'aa' now if we print both the list then you will notice the change only in copied_list and not in original_list because shallow copy doesn't creates new memory for nested list, it just points the same memory, for better understanding see this eg. below - copied_list[2][1[] = 33 now this change can be seen in both the list, because we have made the changes in the nested list, and for nested list it just points the same memory, but it creates a new memory for normal list
@TheWayYouLive-sb8cv4 ай бұрын
great brother saved more time
@dark_legions22272 жыл бұрын
Awesome sirji
@Codeyug2 жыл бұрын
Thanks..
@khetrabasitechvideo3622 жыл бұрын
Love you bro ❤️
@Codeyug2 жыл бұрын
Thanks.. Keep learning
@vandanakarande46842 жыл бұрын
Thanks a lot
@Codeyug2 жыл бұрын
Please have a look at advanced python tutorial
@Muzeemkhankamaal Жыл бұрын
Thanks!
@virendratrivedi3975 Жыл бұрын
nice. sir phir assignment and shallow copy main kya difference hua ?
@Codeyug Жыл бұрын
Difference hai. Aap dono operations krke dekho and har ek chiz ka id check kro.Aapko samajh aa jayega. Else rat ko mai ek short video bna dunga
@cseducation932 жыл бұрын
Nice
@Codeyug2 жыл бұрын
Keep learning from this channel
@arfatbagwan484 ай бұрын
why there is changes in memory addresses of mylist and newlist