Python Tutorial | Python List | Access Items in List | Change Items in List | Slicing
In this video, You will learn Python Lists.
"""Python List"""
"""
1. Lists store multiple items in a single variable.
2. Lists can store different data types while Array can't store.
3. Lists are mutable i.e Lists can be changed.
4. Lists allow duplicate values.
5. Lists insertion order is maintained.
6. Lists are represented using square brackets [] and
values are separated using comma (,).
"""
""" Create a List"""
# Mylist = [10, "India", -50, 30.22, True, 10, 10]
# print(Mylist)
# "# type() function"
# print(type(Mylist))
"# List() constructor"
# MyList = list((10, "India", -50, 30.22, True, 10, 10))
# print(MyList)
# "type() function"
# print(type(MyList))
"# Access Items in List:"
"# Using Indexing starts from 0, 1, 2, ..."
# Mylist = [10, "India", -50, 30.22, True, 10, 10]
# print(Mylist[6])
"# Using Negative Indexing starts from -1, -2, ..."
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[-5])
"# Slicing in Lists"
"# In Slicing, range of index is provided that is" \
"Start index and End index"
"# End index-1 "
"# Last index is not considered in output and " \
"it runs upto the second last end index"
"# Example 1"
"# Start index and End index"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[0:3])
"# Example 2"
"# Leave End Index"
"# It will run upto the end of the list"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[4:])
"# Example 3"
"# Leave Start Index"
"# It will assume 0 as start index"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[:6])
"# Example 4"
"# Leave Start Index and End Index"
"# It will print the complete list"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[:])
"# Example 5"
"# Slicing using Negative indexing "
"# Slicing runs from Left to Right Direction or " \
"from start to end "
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[-3:-1])
"# Example 6"
"# Slicing using Negative indexing "
"# Leave Start index"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[:-3])
"# Example 7"
"# Slicing using Negative indexing "
"# Leave End index"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# print(Mylist[-7:])
"# Change Items in List"
"# By using index"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
# Mylist[1] = "France"
# Mylist[6] = "Paris"
# Mylist[4] = False
# print(Mylist)
"# Iteration in List:"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
"# Using For loop"
# for x in Mylist:
# print(x)
"# Repetition in List:"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
"# using multiplication (*) "
# print(Mylist*2)
"# Membership in List:"
# Mylist = [10, "India", -50, 30.22, True, 10, 'Delhi']
"# using If and in keyword "
# if 10 in Mylist:
# print("Yes")
# else:
# print("No")
"# Length of a List:"
Mylist = [10, "India", -50, 30.22, True, 10, 10, 10]
"# using len() function"
"# How many items are available in the list including" \
"duplicate items"
print(len(Mylist))
"# Add Items in the list:"
See the next video...
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tutorial | Python List | Access Items in List | Change Items in List | Slicing», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.