Python List Basic Information You Need To Know

Опубликовано: 22 Февраль 2021
на канале: Dubious Code
23
1

The basic information of python lists.
Lists live in square brackets.

list1 = [] # this is an empty list

like everything else in python, these lists are 0 indexed. So if I had this list

list1 = ['a','b','c','d']

and I wanted to get the 'a' out I could call index 0

print (list1[0])

More than that, you can,
append()
extend()
insert()

to add to a list

You can
remove()
pop()

to delete from a list.

You can also
sort()
reverse()

it. I would also say that you could slice it and dice it, but dicing isn't a thing in Python. Slicing is. This is what a list slice looks like

list2 = list1[start : end]


На этой странице сайта вы можете посмотреть видео онлайн Python List Basic Information You Need To Know длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Dubious Code 22 Февраль 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 23 раз и оно понравилось 1 зрителям. Приятного просмотра!