RUVIDEO
Поделитесь видео 🙏

Python Programming in 30 Days Day -19

Python Programming in 30 Days Day -19

Exam block #4: Data Collections – Lists, Tuples, and Dictionaries (23%)
Objectives covered by the block (7 exam items)

simple lists: constructing vectors, indexing and slicing, the len() function
lists in detail: indexing, slicing, basic methods (append(), insert(), index()) and functions (len(), sorted(), etc.), del instruction, iterating lists with the for loop, initializing, in and not in operators, list comprehension, copying and cloning
lists in lists: matrices and cubes
tuples: indexing, slicing, building, immutability
tuples vs. lists: similarities and differences, lists inside tuples and tuples inside lists
dictionaries: building, indexing, adding and removing keys, iterating through dictionaries as well as their keys and values, checking key existence, keys(), items() and values() methods
strings in detail: escaping using the \ character, quotes and apostrophes inside strings, multiline strings, basic string functions.


Python Lists

List is a collection which is ordered and changeable. Allows duplicate members.

Create a List:
thislist = ["apple", "banana", "cherry"]print(thislist)

Add Items
To add an item to the end of the list, use the append() method:

Example
Using the append() method to append an item:

thislist = ["apple", "banana", "cherry"]
thislist.append("orange")
print(thislist)


Python Lists

Remove Item
There are several methods to remove items from a list:

Example
The remove() method removes the specified item:

thislist = ["apple", "banana", "cherry"]thislist.remove("banana")print(thislist)

Copy a List
Make a copy of a list with the copy() method:
thislist = ["apple", "banana", "cherry"]
mylist = thislist.copy()
print(mylist)


Python Dictionary

A dictionary is a collection which is unordered, changeable and indexed. In Python dictionaries are written with curly brackets, and they have keys and values.

Example
Create and print a dictionary:
thisdict = {  "brand": "Ford",  "model": "Mustang",  "year": 1964}print(thisdict)

The dict() Constructor
It is also possible to use the dict() constructor to make a new dictionary:

Example
thisdict = dict(brand="Ford", model="Mustang", year=1964)

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Programming in 30 Days Day -19», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.