background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Уроки Python - Словари (dict)"

input logo icon
Video tags
|

Video tags

python
уроки python
python уроки
python для начинающих
python учить
курс python
python курс для новичков
python tutorial
python установка
python как начать
python введение
python junior
программирование на python
программирование
python программист
python разработка
python программа
python словари
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:01
developer channel, don’t forget to subscribe
00:00:03
to the channel and also like this
00:00:05
video. Today I would like to recommend to you
00:00:06
the school of these technologies skill factory,
00:00:08
which offer a 6-month
00:00:10
online course for those who want to master the
00:00:12
python programming language without spending any money.
00:00:14
years to study and become a
00:00:16
sought-after specialist in the labor market, by
00:00:18
the end of the course you will be ready to
00:00:20
take freelance orders and create your
00:00:22
own projects new enrollment for the course
00:00:24
starts monthly, follow the link
00:00:26
in the description under this video on the site there is
00:00:28
also a full course program I
00:00:30
recommend to everyone and we we continue the
00:00:32
python lessons for beginners in the last video we
00:00:34
looked in detail at how
00:00:36
tuples work in the python programming language
00:00:38
in this video lesson we will move on and
00:00:40
talk in detail about dictionaries word vodka
00:00:42
one of the most commonly used
00:00:44
data structures that allows you to store
00:00:46
objects for access that use a
00:00:48
key in a number of programming languages
00:00:50
similar structures
00:00:52
are dictionaries all sharp and associative
00:00:54
arrays in php
00:00:55
objects in java script in this lesson we
00:00:57
will look in detail at the operations of creating
00:01:00
deletion and in general working with dictionaries
00:01:02
and their methods a dictionary is a
00:01:04
data structure also called an
00:01:07
associative array designed for
00:01:09
storing arbitrary objects with
00:01:11
access by key, the data in the dictionary
00:01:12
is stored in a key-value format,
00:01:14
if you remember such a structure as a
00:01:16
list whose elements
00:01:18
are accessed by an index, which is a
00:01:21
non-negative integer, and we ourselves are
00:01:24
not directly involved in creating the
00:01:26
index in the dictionary and the analogue of the index
00:01:28
is the key; in this case, you create the key
00:01:31
on our own, let's take a deep
00:01:32
dive into creating changes to deleting and
00:01:35
working with dictionary elements. An
00:01:48
empty dictionary can be created by specifying curly braces or using the dict function. Let's create the dkt variable and create our first dictionary accordingly. Duck t2. Let's try using the dict function. Here we have created two empty dictionaries.
00:01:50
this is to check and display the type using the
00:01:53
type function,
00:01:55
let's open the terminal and as you can
00:01:57
see, the data type is dict, respectively,
00:01:59
if we put it like this, these two will be
00:02:01
similar, it’s no secret if you
00:02:03
want to create a dictionary with a pre-
00:02:05
prepared data set, then you can
00:02:07
use one of the ones I listed
00:02:09
approaches but with a
00:02:11
key-value enumeration and let's immediately, for example,
00:02:13
create some kind of
00:02:15
dictionary for example we have a key this
00:02:17
will be the name John then you put
00:02:19
a colon and put its value for
00:02:21
example 35 then for example Alex example
00:02:24
27 well and there is some kind -n I don’t know,
00:02:27
let’s put 42 accordingly, here we have brought out
00:02:30
our dictionary, let’s get it accepted,
00:02:32
now it will look like this,
00:02:34
everything is very simple, try it yourself, also
00:02:36
practice, write down, be sure to
00:02:38
write down,
00:02:39
then to add a dictionary element,
00:02:41
you need to specify a new key and its value,
00:02:44
for example, let’s do this so
00:02:46
then in square brackets we enter a
00:02:49
new key for example Dima and then we enter
00:02:52
its value for example and display it
00:02:55
one more time in this glory so that you
00:02:57
can see the difference in how it will look like
00:02:59
in the second case our chest
00:03:01
has been replenished with one
00:03:02
more key Dima one more
00:03:04
their meanings are numbers 12 in our dictionary, because
00:03:06
strings are used as keys and
00:03:08
numbers are used as values, but these are
00:03:11
not necessarily keys and values ​​must
00:03:13
be of the same type, they can represent
00:03:16
different types, well, for example, let’s enter
00:03:18
a unit here, it can also be
00:03:21
different data by value, and
00:03:24
we can also here present other values
00:03:26
and let's look at the result, well, as
00:03:29
you can see, everything is displayed, everything
00:03:31
works for us, to delete an element from the
00:03:32
dictionary, you can use the
00:03:35
to-do command and let's in this case delete
00:03:38
some specific element of
00:03:40
the examples, here we have the first one, respectively,
00:03:42
let's see what now in in the second
00:03:45
case, we won’t have it anymore because
00:03:46
here we also enter this
00:03:48
option with it and delete it, it
00:03:49
will be immediately displayed and the value that
00:03:51
we need without this first element, we’ve
00:03:53
figured it out well, let’s talk a
00:03:55
little about working with access dictionaries
00:03:57
Dictionary elements are accessed in the same way as
00:03:59
access to list elements, only
00:04:01
we specify a key as an index
00:04:03
and let's print edge for example, we will display
00:04:06
the value for
00:04:07
them by index alex in this case we
00:04:10
see kiev everything is very simple,
00:04:11
practice also with the rest if
00:04:14
we see b m here accordingly, we
00:04:16
will get the result that we need, everything is
00:04:18
very simple, you can also check the
00:04:19
presence of a key in the dictionary, this action
00:04:22
is performed using the operator and, and
00:04:23
let’s
00:04:25
do it this way Prince,
00:04:27
further here we see been in
00:04:29
age and that the variable that contains
00:04:31
our dictionary and in this case, it should
00:04:33
display a corpse because b m element
00:04:36
exists in this dictionary,
00:04:37
and if we enter some other
00:04:39
value, then we get
00:04:41
falls, let's now talk about
00:04:42
dictionary methods, delete this value, and
00:04:45
for example, the first method will be the
00:04:48
clear method, and here let's output
00:04:49
this dictionary, respectively, now we
00:04:52
would have an empty dictionary, the clear method
00:04:54
deletes all elements of the dictionary, everything is very
00:04:56
simple, let's create a variable h2
00:04:59
and equate to it such a method as
00:05:01
copies, respectively, let's delete, display
00:05:04
edge 2,
00:05:05
this method creates a new copy of the dictionary,
00:05:08
accordingly, very simply, and and jones and
00:05:10
stores accordingly this copy then the
00:05:12
next method is the get method it
00:05:15
returns the value from the dictionary by key
00:05:17
in some cases there is such a
00:05:19
need, let’s immediately follow the
00:05:21
prince this method looks like this
00:05:22
and for example we will display alex
00:05:25
accordingly here we will also get the
00:05:27
values ​​of some bulkheads in some
00:05:29
programs and we need to
00:05:31
use the method, so pay
00:05:34
attention to this, then the
00:05:35
items function looks like this and here
00:05:38
we are, in this case we will return the
00:05:40
dictionary elements by key and value in a form
00:05:43
formatted for us, let's output it
00:05:45
and as you can see we see dict oh there,
00:05:48
accordingly, here they are
00:05:49
formatted and output then the
00:05:51
next method is
00:05:52
this function case it returns the keys of
00:05:55
the dictionary let's also output it well and
00:05:57
accordingly we displayed the dictionary keys here
00:05:59
then the pop method looks like on the
00:06:01
method in this way and for example here we
00:06:04
want to output ben by the key ben
00:06:06
accordingly if the key is in the dictionary then
00:06:09
this element will be removed from the dictionary and
00:06:11
the value will be returned if we further
00:06:14
print and, accordingly, the key and
00:06:17
value b will no longer be here if we
00:06:20
use a similar function pop
00:06:22
oh there it will delete and return the
00:06:25
key-value pair from the dictionary
00:06:26
in this case we will not get true,
00:06:28
respectively, the last element, then
00:06:31
the function plus, it returns the value of the
00:06:34
elements of the dictionary, let's output this,
00:06:37
respectively, MPa
00:06:38
Chile 35 Kiev and the corpse, then comes the
00:06:41
update function you will use in your
00:06:43
work, for example, we have one dictionary
00:06:45
and we know its keys,
00:06:47
but we want to update its value to
00:06:49
For example, here we are creating dictionaries number two
00:06:52
with the variable h 2 and here we will
00:06:55
also have for the first key
00:06:56
not 35a 333, let’s say Alex, let’s say we are
00:07:00
not in Kiev
00:07:02
London, and we’ll add some other key,
00:07:05
let’s say the target is 444 and add the
00:07:09
values ​​falls here,
00:07:10
respectively, if We are the
00:07:13
first to update our dictionary, the second, then we will get a
00:07:16
more complete dictionary with new
00:07:19
meanings, as if we were updated with the values ​​​​with the
00:07:21
first key, that is, now we do not have 35
00:07:23
and 333, then also the Alex key
00:07:26
has also been updated now, not Kifa London, we would
00:07:29
have stayed like that because we didn’t
00:07:30
update
00:07:31
and we added here the keys 444 with
00:07:34
the value falls, respectively, this is how
00:07:36
it all works, while age 2
00:07:38
will remain unchanged, let’s
00:07:41
make sure of this, we will also have a
00:07:43
dictionary like this for us,
00:07:46
only the words speech are changed to which they are added
00:07:48
elements of another dictionary,
00:07:49
but if it is necessary that both source
00:07:51
dictionaries remain unchanged and the result of the
00:07:54
union is some 3 words, then
00:07:56
you can first copy one
00:07:58
dictionary to another and then assign the
00:08:00
next one to the changes, so let’s
00:08:01
move on to enumerating the elements to
00:08:03
enumerate the dictionary, you can use the
00:08:05
for loop basically, as you are already
00:08:07
used to, let’s do this and
00:08:10
leave one dictionary age, we use a for
00:08:12
loop
00:08:13
where we will use the key, then
00:08:17
comes the keyword in and then comes
00:08:19
the name of our dictionary by variable and
00:08:22
accordingly, then we will bring it all,
00:08:25
enter the key key, then we will put
00:08:29
separating them, let's put a dash dash
00:08:31
more precisely and here we write the name of
00:08:34
our dictionary and in square brackets
00:08:37
the values ​​okay, let's see
00:08:39
what we got, accordingly we
00:08:42
went through our dictionary so it all
00:08:45
works there
00:08:46
is another way to iterate through elements
00:08:47
it represents the use of the method
00:08:50
this mts it needs a little change
00:08:53
here here we put key and well you and
00:08:56
then in each we put this function this
00:09:00
accordingly and then here we can
00:09:02
simply use the value of the
00:09:05
blue variable, the same effect is obtained
00:09:09
set to
00:09:10
hedgehogs each crankcase contains the key and the
00:09:13
value of the element which, when iterating over,
00:09:15
we can immediately get in the variable
00:09:17
kay
00:09:18
and we'll and, accordingly, it looks like this,
00:09:21
and there are also
00:09:23
separate possibilities for enumerating keys and
00:09:25
enumerating values ​​to enumerate the keys, we
00:09:27
can call the case method in the dictionary,
00:09:29
respectively, here we change iTunes to
00:09:31
case, and here, accordingly, we enter
00:09:33
just kay only here do not forget to
00:09:36
remove everything and we will get our result by
00:09:40
keys search by keys and also in hp.
00:09:44
let's name here well you,
00:09:47
here we will also put well you
00:09:49
and the function here will be in hp.
00:09:51
accordingly, this is how we see the meanings,
00:09:54
everything is very simple, here you also
00:09:56
practiced and everything worked out for you,
00:09:58
if it didn’t work out, write in the comments
00:10:00
I will try to answer all the questions and that’s all,
00:10:02
thank you all very much for your
00:10:05
viewing, see you all again,
00:10:07
great luck and bye

Description:

Продолжаем подробное изучение программирования на Python для начинающих. Python легкий язык программирования и вся работа с различными типами данных тоже очень проста для любого новичка программиста. В этом видео мы пойдем глубже и рассмотрим все работу с типом данных словари в Python dict. Покажу все действия на простых примерах и задачах. Курс Python -https://skillfactory.ru/python-for-web-developers

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Уроки Python - Словари (dict)" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Уроки Python - Словари (dict)" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Уроки Python - Словари (dict)" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Уроки Python - Словари (dict)" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Уроки Python - Словари (dict)"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Уроки Python - Словари (dict)"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.