Python Programming 18 - Slicing a list and [:] Explained

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


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

This is very clear for me. Thanks for sharing

mahapeyuw
Автор

Why does the below code give me the same object ID for the 1st and 3rd version of the list? I would've though that if I don't use the [:] it will give me a new obj ID every time, but it seems to revert back to the 1st ID when I change the list twice:

list = ["Pen", "Pencil"]

print(id(list))

list = [1, 2, 3]
print(id(list))

list = [item for item in list if item != 2]
print(id(list))

bsykesbeats
Автор

Man, you are amazing you hepled me so mauch.Thank you

aminedouiss
Автор

What is the difference between

backpack2 = backpack

vs

backpack2 = backpack[:]?

firzen
Автор

can anyone please clear my doubt my id, s are the same what to do

rohitshil-yn
Автор

Hello mam I downloaded python 3.8.3 today.
The setup was successful but I was not able to use pip.
When I checked python file I found that the script folder in python was empty.
I installed it several times but the condition was same.Tkinter is also not working..
Plz can you help me??

foodiefriends