All language subtitles for 14. Dictionaries

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,150 --> 00:00:02,060 All right we are in the homestretch everybody. 2 00:00:02,130 --> 00:00:09,270 So we're going to cover dictionaries now and when we think of dictionaries we need to think of key value 3 00:00:09,270 --> 00:00:10,320 pairs. 4 00:00:10,350 --> 00:00:20,050 So let's go ahead and make a do section called dictionaries and we'll just note key value pairs. 5 00:00:20,580 --> 00:00:24,260 Probably put a slash here key slash value pairs. 6 00:00:24,300 --> 00:00:32,690 And we'll also put a little note of curly braces like this so let's talk dictionaries. 7 00:00:32,950 --> 00:00:37,270 So let's say we have a dictionary and we want to have a menu. 8 00:00:37,300 --> 00:00:40,560 Let's make a drink menu again. 9 00:00:40,720 --> 00:00:42,250 Make this however you want. 10 00:00:42,250 --> 00:00:45,910 I'm going to make this based on some alcoholic beverages. 11 00:00:45,910 --> 00:00:51,640 You can absolutely make this more you know Fiji or Fiji 13 or however you want to make it. 12 00:00:51,660 --> 00:00:54,610 But let's say a white Russian. 13 00:00:54,710 --> 00:01:00,610 You go to a bar there's a white Russian on the menu and that White Russian cost seven dollars. 14 00:01:00,820 --> 00:01:09,910 And there's also an old fashion and leaders say that's 10 bucks and then we have lemon drop which is 15 00:01:10,120 --> 00:01:11,860 eight dollars. 16 00:01:11,860 --> 00:01:15,960 So we've got these and we'll close the office with a curly bracket. 17 00:01:16,480 --> 00:01:18,820 And this is what a dictionary looks like. 18 00:01:18,820 --> 00:01:24,380 So if you were to print out drinks we would return our dictionary. 19 00:01:24,550 --> 00:01:29,000 Let's do that. 20 00:01:29,540 --> 00:01:34,990 If I would make this the correct syntax this would work very well for me. 21 00:01:35,080 --> 00:01:36,430 I am human after all. 22 00:01:36,760 --> 00:01:41,040 So you see here white Russian is seven old fashioned ten lemon drop eight. 23 00:01:41,410 --> 00:01:51,240 So you can note here is that the drink is your key and your price is your is your value. 24 00:01:52,450 --> 00:01:54,540 So you have your key value pair here. 25 00:01:54,550 --> 00:01:58,590 So key value key value key value. 26 00:01:59,290 --> 00:02:01,200 Well think of it as another way. 27 00:02:01,210 --> 00:02:05,650 We don't have to just have one parameter or one value. 28 00:02:05,650 --> 00:02:06,790 We have to have a key. 29 00:02:06,790 --> 00:02:09,370 We can have multiple values to a key. 30 00:02:09,760 --> 00:02:11,620 So let's talk about employees. 31 00:02:11,650 --> 00:02:16,750 I'm going to use one of my favorite TV show which is Bob's Burgers to do this. 32 00:02:16,810 --> 00:02:20,100 So let's say we have employees and we have different departments. 33 00:02:20,260 --> 00:02:23,240 So let's say we have a finance department OK. 34 00:02:23,440 --> 00:02:28,430 And inside the finance department we've got Bob. 35 00:02:28,630 --> 00:02:33,770 We've got Linda and we've got Tina. 36 00:02:33,820 --> 00:02:36,220 We have three employees in the finance department. 37 00:02:36,310 --> 00:02:38,850 Then we've got an I.T. department. 38 00:02:40,120 --> 00:02:46,730 And inside of I.T. there might be Gene and Louise. 39 00:02:47,050 --> 00:02:48,750 I will add Teddy to this too. 40 00:02:48,760 --> 00:02:51,250 I'm not going to have to move this over. 41 00:02:51,280 --> 00:02:55,210 So a little bit long and then let's do one more department. 42 00:02:55,210 --> 00:03:03,850 Let's say that there's a Department of H.R. our favorite department and we'll say there's Jimmy Junior 43 00:03:05,410 --> 00:03:07,910 and Mort. 44 00:03:08,200 --> 00:03:08,560 All right. 45 00:03:08,590 --> 00:03:12,330 So this is our dictionary. 46 00:03:12,660 --> 00:03:21,010 Now again we can print out employees and we should be able to see our dictionary here say this. 47 00:03:21,010 --> 00:03:22,120 Give it a print. 48 00:03:23,100 --> 00:03:23,640 Okay. 49 00:03:23,650 --> 00:03:31,420 You can see finance as Bob Linda Tina I.T. has Jean Louise and Teddy and Jimmy Junior and more are in 50 00:03:31,480 --> 00:03:32,310 age are. 51 00:03:32,380 --> 00:03:35,620 I'm gonna fix this typo and. 52 00:03:35,890 --> 00:03:36,370 All right. 53 00:03:36,400 --> 00:03:44,670 So let's say that we want to add a new key value pair well we can say let's say there's a new department 54 00:03:45,430 --> 00:03:55,280 and we could say there's a new department called legal employees and let's add in legal and then we'll 55 00:03:55,280 --> 00:03:59,750 say in legal there is Mr. Frond. 56 00:04:00,860 --> 00:04:11,350 All right and this will add a new key value pair something like this. 57 00:04:11,350 --> 00:04:11,930 All right. 58 00:04:12,120 --> 00:04:13,260 So let's save this. 59 00:04:13,320 --> 00:04:23,320 Go ahead and just print it and if I were to write print afterwards grant employees and we'll save it 60 00:04:24,010 --> 00:04:25,900 Let's print it one more time. 61 00:04:25,990 --> 00:04:32,150 Now you see that legal has been added with Mr. Frond working in legal OK. 62 00:04:32,380 --> 00:04:43,360 Let's do another let's say that we've added somebody to the sales team and let's do it this way. 63 00:04:43,810 --> 00:04:46,110 We didn't have a sales team before but we do now. 64 00:04:46,120 --> 00:04:49,800 So we can also do an update something like this. 65 00:04:49,800 --> 00:04:53,860 We could say update and then we can add in sales 66 00:04:56,590 --> 00:05:03,200 and we can say hey we've got a nice new sales team of Andy and Ollie 67 00:05:06,560 --> 00:05:07,940 and look something like this. 68 00:05:09,580 --> 00:05:18,710 So now we print out in plays we should have Andy and Holly on the sales team as well so there's multiple 69 00:05:18,710 --> 00:05:22,580 ways to add in new key value pairs. 70 00:05:23,060 --> 00:05:32,090 So we can copy this and paste it over here as a key value as well so we can also update things. 71 00:05:32,100 --> 00:05:33,900 This is the last thing I'm going to show you. 72 00:05:33,900 --> 00:05:38,200 We can also update things so we can say go back to our drinks. 73 00:05:38,220 --> 00:05:44,700 Well let's say that we've got the White Russian let's say the White Russian is no longer seven dollars 74 00:05:44,700 --> 00:05:47,740 our menu has changed and it's now eight dollars. 75 00:05:48,150 --> 00:05:56,020 So we're going make eight dollars and we'll just print out drinks and we can save that print it and 76 00:05:56,020 --> 00:06:02,330 I could see the White Russian is now eight dollars instead of seven from before we can also get some 77 00:06:02,360 --> 00:06:04,430 items out of a dictionary. 78 00:06:04,620 --> 00:06:08,120 So say print during stat get. 79 00:06:08,120 --> 00:06:09,880 And will this get the White Russian. 80 00:06:10,110 --> 00:06:14,880 And let's see what that returns. 81 00:06:15,320 --> 00:06:23,430 So you pull specifically from a dictionary here and you see that the White Russian has a value of eight. 82 00:06:23,460 --> 00:06:25,840 So this is it for dictionaries. 83 00:06:25,950 --> 00:06:27,860 You're not going to really see it come up in this course. 84 00:06:27,870 --> 00:06:31,530 But again this is another valuable thing with Python to know. 85 00:06:31,530 --> 00:06:38,490 So we have covered lists which have brackets like this we've covered tuples which have parentheses and 86 00:06:38,490 --> 00:06:42,020 then now we have covered dictionaries which have the curly braces. 87 00:06:42,240 --> 00:06:48,570 And now when you're reading code you should be able to identify all of them differently. 88 00:06:48,570 --> 00:06:50,610 This is why this was important. 89 00:06:50,610 --> 00:06:53,610 Everything has been building upon up until this point. 90 00:06:53,610 --> 00:06:53,910 Right. 91 00:06:54,150 --> 00:06:56,020 So now you will identify. 92 00:06:56,050 --> 00:06:58,090 Ok I see those curly braces. 93 00:06:58,230 --> 00:07:03,060 That's going to be a dictionary or I see these these brackets here. 94 00:07:03,150 --> 00:07:04,650 That's going to be a list. 95 00:07:04,650 --> 00:07:10,890 So keep that in mind and moving forward you should be able to now start reading this code and understanding 96 00:07:10,890 --> 00:07:16,800 this code in from the beginning I told you we don't have to be developers but we do have to be able 97 00:07:16,800 --> 00:07:17,730 to read code. 98 00:07:17,790 --> 00:07:21,030 So the more I show you the better off that you're going to be. 99 00:07:21,030 --> 00:07:22,830 So we're going to wrap up this lesson. 100 00:07:22,830 --> 00:07:28,040 We've got a couple more before we start building our scripts and we'll be a be good to go and move into 101 00:07:28,080 --> 00:07:31,040 hacking so I'll catch you over in the next lesson. 9358

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.