All language subtitles for 14. enumerate()

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Let me show you another useful function that we'll use just like a range.

Mind you it's not as common as range.

Range you'll see it a lot in Python code but this other one is still very useful.

And it's called enumerate.

Now what does it do.

Let's have a look.

I can do a for loop and I'll say 4 and we'll say character in enumerate and then enumerate.

We wrap around something that well we want to enumerate.

So let's see what that means.

It returns and enumerate to object.

So interval must be an other object that supports iteration.

So we have to give it something that enumerate can iterate over.

So this time around let's just do a a string that says hello.

Now enumerate is special because what it's going to give us is it's going to take an editable object

and gives you an index counter and the item of that index.

What I mean by that.

Well you can actually say I comma character.

So we're unpacking this and we're saying hey print I and character.

If I click Run look at that I get Hello iterated over again.

If we don't have enumerate then we would have just gotten Hello.

But we also because we use enumerate we get this eye or index of each item and where it is in the index

so that if I had a list here let's say 1 2 3 again I'm able to use and access the index number of the

item as well.

What if we had a couple

again we get the index number so enumerate is very useful if you need the index counter of the item

that you're looping through so let's do a little exercise let's say that we want to create a script

that enumerates a list of numbers 1 through 10.

So we'll use range to create that I'm going to say list and then I'm going to say range.

I know there's a lot of functions here range that is one hundred and actually list to that and I want

to be told what the index of the number 50 is.

So pause the video if you need to do that.

Now here I want it so that let me make this a little bit bigger.

I want it so that we only print the index of let's say the value 50.

I want to know where 50 is in the list.

Now again this is a simple example seeking probably already guess what the answer is.

But how would you code this so that only in here we get the index of 50 or it says the index of 50 is

whatever positive video if you want to give it a go.

Otherwise let's try this I'm going to do a conditional and says if character is equal to 50 then I'm

going to print index or I'm going to do an F string and I'll say that the index of 50 is and then I'll

add the index in here so that if I run

I get index of 50 is 50 and just to confirm if for example I just print here and let's say print I in

character I click Run we see that map we have the index is the same as the numbers again not too difficult

of a question but you see here that we're able to extract this information again not as useful as range

but you will see it occasionally in code.

So I wanted to make sure that you're not surprised by it as you can see it's not that difficult.

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