All language subtitles for 27. Docstrings

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:00,750 --> 00:00:06,870 There is a unique thing that we can do with functions that we haven't seen before. 2 00:00:07,000 --> 00:00:08,970 And they're called Doc strings. 3 00:00:08,970 --> 00:00:09,780 Let me show you what I mean. 4 00:00:10,380 --> 00:00:17,610 If I had a function here and we'll just call it test and test let's say receives a parameter that is 5 00:00:17,670 --> 00:00:26,800 a and in here it's going to print a what a useless completely useless function. 6 00:00:26,800 --> 00:00:34,270 Now if I run this well nothing's going to happen because I have to call test and then say well exclamation 7 00:00:34,270 --> 00:00:41,020 marks and you see that our function works but we can actually with functions in Python use something 8 00:00:41,020 --> 00:00:44,320 called Doc strings and it looks something like this. 9 00:00:44,530 --> 00:00:47,650 You do single code single code single code. 10 00:00:47,770 --> 00:00:52,500 So three of them and then at the bottom once again single code single code single code. 11 00:00:53,170 --> 00:01:02,590 So the beginning of the function like this and in here I can add some info about the function for example 12 00:01:02,650 --> 00:01:11,630 this function tests and prints param a. 13 00:01:11,670 --> 00:01:13,270 Now here's the interesting part. 14 00:01:13,530 --> 00:01:22,170 If I run test here and I do brackets look at that my editor tells me info this function tests and prints 15 00:01:22,200 --> 00:01:23,830 program a. 16 00:01:23,910 --> 00:01:26,770 This is called a dork string. 17 00:01:27,210 --> 00:01:34,950 And what it allows us to do is to actually comment inside of our functions in a way that if another 18 00:01:34,950 --> 00:01:41,160 person let's say is using the test function they can actually let's say in the future when we write 19 00:01:41,250 --> 00:01:47,280 large applications where it's not just ten lines of code or maybe we have different files instead of 20 00:01:47,760 --> 00:01:50,310 just finding what test does. 21 00:01:50,310 --> 00:01:58,430 As I'm typing it it's going to tell me hate tests is going to return or print param a. 22 00:01:58,470 --> 00:02:04,860 So I find out information about this and if we ever use something like length for example and run this 23 00:02:05,190 --> 00:02:11,830 you'll see that this gives us information about the function by using dark strings. 24 00:02:11,910 --> 00:02:16,540 But it comes built in with Python another way to view this. 25 00:02:16,540 --> 00:02:22,180 Mind you when we talk about devolve power environments our editors are going to do this automatically 26 00:02:22,570 --> 00:02:25,420 but there's a few other ways that we can actually read this. 27 00:02:25,420 --> 00:02:33,010 For example I can do the help function which we haven't seen before which comes pre-built with Python 28 00:02:34,420 --> 00:02:36,050 and we don't want to call the function. 29 00:02:36,070 --> 00:02:44,440 I just want to call help on test if I run this look at that I get test a info. 30 00:02:44,440 --> 00:02:50,890 This function tests and prints parameters so it can use help to find out what a function does which 31 00:02:50,890 --> 00:02:52,870 is really really useful. 32 00:02:52,900 --> 00:03:00,370 One other way to do this is to use what we call a magic method or a Dunder method which again we'll 33 00:03:00,370 --> 00:03:01,990 get into later on in the course. 34 00:03:02,110 --> 00:03:11,030 I do double underscore then I do doc and then double underscore like this if I click Run 35 00:03:14,050 --> 00:03:21,570 while we have to print something here so let's print quick run and look at that. 36 00:03:21,590 --> 00:03:30,300 I get the same thing so these Doc strings are really really useful to add comments and definitions to 37 00:03:30,300 --> 00:03:37,650 your functions so that when other people on your let's say team or co-workers come across your function 38 00:03:37,650 --> 00:03:43,530 that you created they're able to understand what it does right away without searching through your python 39 00:03:43,530 --> 00:03:45,230 files or multiple files. 40 00:03:45,330 --> 00:03:46,680 Very useful feature. 4386

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