All language subtitles for 18. Dictionary Types

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian Download
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: 0 1 00:00:00,360 --> 00:00:05,630 So you are a teacher and you wanted to calculate the average grades of your students. 1 2 00:00:05,640 --> 00:00:12,970 And do we do that using this algorithm here and this data structure to store the grades. 2 3 00:00:13,260 --> 00:00:18,030 The problem here is you don't know which grade is of who. 3 4 00:00:18,030 --> 00:00:26,070 So while a lise is a good data structure to store an array of items, it's not good enough when these 4 5 00:00:26,070 --> 00:00:30,400 items have some sort of identity attached to them. 5 6 00:00:30,510 --> 00:00:33,350 In that case you want to use a dictionary. 6 7 00:00:35,930 --> 00:00:41,310 Let's say student grades curly brackets. 7 8 00:00:41,350 --> 00:00:44,990 That's a syntax for a dictionary. 8 9 00:00:45,000 --> 00:00:51,230 And then you use names of your students. Let's say Marry, a colon. 9 10 00:00:51,530 --> 00:00:54,920 Make some space or not, whatever you prefer. 10 11 00:00:54,950 --> 00:00:58,430 But it's good to have a space there to make it more readable. 11 12 00:00:58,700 --> 00:01:01,460 And then you write the grade of Merry. 12 13 00:01:03,350 --> 00:01:07,780 Let's say Sim, 8.8. 13 14 00:01:10,470 --> 00:01:15,760 John colon, 7.5. 14 15 00:01:16,180 --> 00:01:20,980 So the difference between the dictionary and the list is the brackets, different brackets. 15 16 00:01:20,980 --> 00:01:25,740 And then this is considered an item in a dictionary. 16 17 00:01:25,750 --> 00:01:28,140 This is considered an item in a list. 17 18 00:01:28,300 --> 00:01:32,530 So items in a dictionary are made of keys. 18 19 00:01:32,530 --> 00:01:34,650 This is a key, and values. 19 20 00:01:34,660 --> 00:01:42,370 This is a value. A list would be more appropriate if we had to store for example an array of temperature values. 20 21 00:01:42,370 --> 00:01:54,380 Let's say Monday had these temperatures. Monday temperatures. 21 22 00:01:54,530 --> 00:02:01,970 And lastly how do we calculate the average when we have a dictionary? Since these are pairs of keys 22 23 00:02:01,970 --> 00:02:03,030 and values. 23 24 00:02:03,110 --> 00:02:07,310 You can't just make the sum like that. 24 25 00:02:07,310 --> 00:02:11,960 You need to specify the sum of what you want to get. 25 26 00:02:11,960 --> 00:02:20,990 So student grades and if you check dir dict for dictionary, you'll see that dictionaries have these 26 27 00:02:21,140 --> 00:02:33,110 values which is a method, dict.values it is a method and it provides a view of a dictionary of values. 27 28 00:02:33,970 --> 00:02:34,940 In simple words 28 29 00:02:34,940 --> 00:02:37,610 it gives you the values of a dictionary. 29 30 00:02:37,610 --> 00:02:50,840 So if you get this dictionary, Q for quit here, paste it here, and see student_grades.values and that 30 31 00:02:50,840 --> 00:02:54,620 will give you this data type. 31 32 00:02:54,650 --> 00:02:56,300 So it's still a data type. 32 33 00:02:56,330 --> 00:03:03,260 It does look like at list, it's not exactly a list, but it behaves like a list with these three values 33 34 00:03:03,470 --> 00:03:04,420 there. 34 35 00:03:04,430 --> 00:03:06,920 So it's a dict values type. 35 36 00:03:06,920 --> 00:03:15,680 That method produces this type and therefore you can add that in there. 36 37 00:03:15,680 --> 00:03:17,160 Don't forget the parentheses. 37 38 00:03:17,180 --> 00:03:18,890 Don't forget to save. 38 39 00:03:19,010 --> 00:03:25,100 And don't forget to execute to give the output and this is the average value of a dictionary of values. 39 40 00:03:25,190 --> 00:03:28,400 To get the keys of a dictionary 40 41 00:03:28,400 --> 00:03:38,660 just do keys and you get this dict keys type with the keys of the dictionary as items of that dict keys 41 42 00:03:38,680 --> 00:03:39,080 arrays. 4059

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