All language subtitles for 13. range()

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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,420 --> 00:00:10,540 When looping in Python one of the most common tools is this range function that we get out of the box 2 00:00:10,540 --> 00:00:18,850 with Python and you see here that range well is a Range object a special type of object in Python that 3 00:00:18,850 --> 00:00:27,610 returns an object that produces a sequence of integers from start to stop let's explore that are a little 4 00:00:27,610 --> 00:00:41,480 bit more if I print here a range and I say range one hundred and I click Run I get range of zero to 5 00:00:41,570 --> 00:00:44,310 one hundred. 6 00:00:44,730 --> 00:00:47,270 So it looks like a tulpa but it's not. 7 00:00:47,280 --> 00:00:54,750 It's a Range object and it's a special type of object and a range you can give it like this which gives 8 00:00:54,750 --> 00:00:59,500 you a default of zero to whatever you give it which is 100. 9 00:00:59,850 --> 00:01:02,910 Or you can just simply Type 0 one. 10 00:01:03,230 --> 00:01:11,100 And if I click Run it's the same thing but where range becomes really useful and you'll see this in 11 00:01:11,310 --> 00:01:19,200 99 percent of cases in Python is in for loops you see besides topples and lists and sets and dictionaries 12 00:01:19,200 --> 00:01:19,910 and strings. 13 00:01:20,070 --> 00:01:22,830 You can iterate over a range. 14 00:01:22,830 --> 00:01:32,730 So for example if I do for i in range and there's a say item or in our case letters to number in range 15 00:01:33,900 --> 00:01:43,470 and in here I do print no if I run this you'll see that I'll get numbers 1 to 100. 16 00:01:43,570 --> 00:01:46,100 And why is this useful. 17 00:01:46,120 --> 00:01:54,100 Well using a range I was able to loop a hundred times as you can see all the way till 99 because our 18 00:01:54,100 --> 00:02:02,080 count starts at 0 and we're able to loop as many times as I want so I can tell the loop maybe we want 19 00:02:02,080 --> 00:02:08,380 to loop a certain number of times maybe you won't want to loop 10 times where I can tell the loop how 20 00:02:08,380 --> 00:02:18,410 many times to run it's extremely useful maybe here we're performing some action where it says I don't 21 00:02:18,410 --> 00:02:26,720 know email the email list so we want to send 10 emails to an email less for example. 22 00:02:26,720 --> 00:02:34,610 Well again I can just click Run and I sent that email while a bunch of times 10 times. 23 00:02:34,610 --> 00:02:41,420 Another neat trick is that while you might not even need no great we're not really using it in our code 24 00:02:42,050 --> 00:02:48,560 and often while you'll find in python programs is If a programmer doesn't need this variable you just 25 00:02:48,560 --> 00:02:52,090 do an underscore and this is just a variable. 26 00:02:52,130 --> 00:03:01,540 I mean you could use it like this and you'll still get these numbers but it just indicates to other 27 00:03:01,540 --> 00:03:04,380 people that hey I don't really care what this variable is. 28 00:03:04,390 --> 00:03:07,720 I'm just trying to use range so that we can loop over things. 29 00:03:07,750 --> 00:03:14,020 Let's say 10 times now range also comes with a third parameter. 30 00:03:14,400 --> 00:03:16,880 And what that is is they step over. 31 00:03:16,890 --> 00:03:18,240 So if I do too. 32 00:03:18,420 --> 00:03:18,950 And by the way. 33 00:03:18,950 --> 00:03:20,370 Default is one here. 34 00:03:20,370 --> 00:03:29,990 If I do two it jumps from zero to 10 by two which is very very handy. 35 00:03:31,230 --> 00:03:32,570 So what is the range. 36 00:03:32,700 --> 00:03:38,670 Well range creates a special kind of object that we can iterate over OK. 37 00:03:38,680 --> 00:03:41,250 What if I do minus. 38 00:03:41,410 --> 00:03:41,960 Right here. 39 00:03:41,980 --> 00:03:44,350 What if I do minus one. 40 00:03:44,350 --> 00:03:50,800 Well if I run this Hmm that's not going to work because well let me show you why. 41 00:03:51,560 --> 00:03:56,570 If I change this to zero and 10 and I do minus one 42 00:04:01,100 --> 00:04:10,740 it's going to go in the opposite direction but if I did just ten and zero that's not going to work. 43 00:04:10,950 --> 00:04:16,770 If we want to do something in reverse we just have to make sure that we add that minus one or if we 44 00:04:16,770 --> 00:04:19,590 want to step back twice. 45 00:04:19,680 --> 00:04:21,300 Then we click Run. 46 00:04:21,300 --> 00:04:26,260 So you have a lot of options to play with the range. 47 00:04:26,400 --> 00:04:30,070 You can do ascending descending one final thing. 48 00:04:30,340 --> 00:04:32,690 Another place that you might see ranges. 49 00:04:32,740 --> 00:04:38,530 And like I said most of the time they're in for loops but he can also do something interesting like 50 00:04:38,560 --> 00:04:52,990 let's say a range of 10 and then if we wrap this in a list remember a list function allows us to convert 51 00:04:52,990 --> 00:04:54,340 something to a list. 52 00:04:54,340 --> 00:05:03,990 If I run this does you see that let's simplify this so that this range is going to just be too if I 53 00:05:03,990 --> 00:05:13,110 click Run you see that I loop two times and in here I'm going to print first of all I'm going to create 54 00:05:13,110 --> 00:05:21,000 a range and it a rebel object that has 10 items and then I'm going to convert that into a list so you 55 00:05:21,000 --> 00:05:24,270 can see here zero to nine into a list. 56 00:05:24,600 --> 00:05:33,870 So this is a quick way to create a list that ball has integers a neat trick that you'll definitely use 57 00:05:33,900 --> 00:05:37,830 along your program or journey I'll see in the next one. 58 00:05:37,860 --> 00:05:38,270 But by. 5998

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