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

Python Tutorial for Absolute Beginners - #5 Dictionaries

Learn programming in Python 100 seconds at a time in this video for absolute beginners. This is video number 5: Dictionaries.
I know im going fast in this video, please use timestamps below to navigate the video.
Timestamps:
00:00 - Start
00:03 - Recapping Lists
00:13 - Key Value Pairs
00:25 - example dictionary in Python
00:43 - printing a dictionary
00:52 - adding a key value pair
00:59 - starting with an empty dictionary
01:05 - deleting a key value pair
01:10 - different format dictionary
01:14 - looping through a dictionary - keys
01:28 - looping through a dictionary - values
01:33 - looping through a dictionary - keys and values

—————————————————————
DICTIONARIES
—————————————————————

A dictionary is similar to a list.
It contains a set of items
But instead passing an index number, like 0 or 1 to retrieve an item SHOW PRINTE FUNCTION LIST WITH PRINTINGN THE FIRST OR SECOND ITEM
In a dictionary each value is associated with a key
To paint a picture, here is a table of information
The first column can be named the keys
And the second one the values
TABLE WITH FIRST NAME, SECOND NAME, FAVOURITE CVOLOR
In Python a dictionary would be written like this
KEYNOTE SHOW
The part before the colon is the ‘key’ and the part after the colon is the ‘value’
Together they are called a ‘key-value pair’.
Each ‘key-value pair’ is separated by a comma
To print the value for a key, pass the key
Note that in Python a dictionary is written with curly brackets

Info = {‘first_name’:’’John’,’last_name’:’Doe’, ‘age’:33}
print(info[‘first_name’])

Dictionaries are mutable, like lists, so you can add new key-value pairs like this
info[‘eye_color’] = ‘blue’
Like lists you can start a dictionary empty and then fill it with keyvalue pairs
Info_2 = {}
info_2[‘dummy’] = ‘data’
info_2[‘dummy_1’] = ‘data_1'
Just use a vs studio, this is a very short scene
And to modify a the value of a key, we just pass the new value like this
info_2[‘dummy’] = ‘new data’
print(info_2[‘dummy’])

The ‘del’ method is used to delete a key-value pair
Del info_2[‘dummy_1’]
print(info_2)

A dictionary can also be written like this in python
Colors = {
‘jack’:’red’
‘John’:’blue’
‘jinny’:’yellow’
}


All the keys can be printed with a for loop
For name in colours.keys():
print(name)
You can also omit the .keys method, because the default is to print the keys
So this will produce the same result
For name in colours:
print(name)
A for loop can also be used to print out all the values in a dictionary
For color in colors.value():
print(col or)
Finally we can also do both at the same time with the help of the .items() method
First define two variables, one to store the key and one to store the value
We use the items method on the dictionary
Then two lines, one print function for the keys and one for the values
For key, value in colors.items():
print(“Key: “ + key)
print(“Value: “ + value)

————————————————————————



? Who are you?
My name is Raza. I am 30. I am a manager within IT for a year, but I’ve been an accountant for the majority of my career.
I’m in love with #Python :)

You can find me here:
? Instagram: https://www.instagram.com/razacodes/
? Twitter: https://twitter.com/razacodes
—————————————————————————————

Goals for 2021
Training Python hours: 30/1000
Python/Django Projects: 1/30
Subscribers: 1329/10,000

—————————————————————————————-
#100SecondsOfCode
#pythonforbeginners #programming

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tutorial for Absolute Beginners - #5 Dictionaries», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

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

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

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