All language subtitles for 8. Challenge 2 - Sum of Digits in a Number

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
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 Download
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,240 --> 00:00:05,430 So in this challenge, what we are going to do is to write the recursive function that first of all, 2 00:00:05,430 --> 00:00:08,630 what it will do is receive a number NUM. 3 00:00:08,940 --> 00:00:16,170 And once it receives these num, all the recursive function task is to find out and return the sum of 4 00:00:16,170 --> 00:00:16,860 all digits. 5 00:00:17,070 --> 00:00:18,660 In this particular number. 6 00:00:19,080 --> 00:00:21,040 So we simply take a given number. 7 00:00:21,050 --> 00:00:25,050 It may of one digit two digits, three digit digits and so on. 8 00:00:25,500 --> 00:00:31,980 And all these function has to do is to find out what will be the sum of all the digits. 9 00:00:32,130 --> 00:00:40,200 So, for example, if we take NUM as 67, then we know that the sum of all of its digits will be six 10 00:00:40,200 --> 00:00:43,040 plus seven, which is a total of 13. 11 00:00:43,130 --> 00:00:43,460 Okay. 12 00:00:43,650 --> 00:00:48,280 And the function, once it's found out, are all the sum of the digits. 13 00:00:48,470 --> 00:00:51,040 The function simply should return 13. 14 00:00:51,210 --> 00:00:58,470 In this example, any a for another example, we have NUM like nine thousand five hundred thirty one. 15 00:00:58,800 --> 00:01:03,180 So the sum of digits is going to be pretty much calculated in the same way. 16 00:01:03,180 --> 00:01:03,410 Right. 17 00:01:03,450 --> 00:01:07,320 Because we use some recursive calls. 18 00:01:07,320 --> 00:01:09,030 We divided to solve problems. 19 00:01:09,030 --> 00:01:15,060 And it doesn't matter for us how many digits there will be in a given number as long as we know the 20 00:01:15,060 --> 00:01:20,310 formula to how to divide it, to solve problems and make our recursive calls. 21 00:01:20,430 --> 00:01:26,070 So in this case, if we want to know that some of these just we will simply sum up nine plus five plus 22 00:01:26,070 --> 00:01:32,340 three plus one, which give us a total off of what it will be, the total of 18. 23 00:01:32,520 --> 00:01:34,800 So that's pretty much the exercise. 24 00:01:34,830 --> 00:01:37,080 We have to write the recursive function. 25 00:01:37,110 --> 00:01:42,660 I know it's kind of tempting to use just thing for a loop to find out what will be the result. 26 00:01:42,710 --> 00:01:42,970 Right. 27 00:01:43,050 --> 00:01:45,840 Because we can use for a loop, so why wouldn't we use it? 28 00:01:46,710 --> 00:01:47,790 Something that we know. 29 00:01:48,210 --> 00:01:54,360 And the reason is very simple, because our task is to practice some recursive approach to find out 30 00:01:54,360 --> 00:02:01,260 how can we divide, to solve problems are some bigger problem, and then to reach some base condition 31 00:02:01,260 --> 00:02:08,960 or a stopping condition and to build up all our way up to find Venus the necessary result. 32 00:02:09,120 --> 00:02:10,380 So take your time, guys. 33 00:02:10,440 --> 00:02:11,700 Think about the solution. 34 00:02:11,730 --> 00:02:14,160 Try to understand what will be the base case. 35 00:02:14,190 --> 00:02:15,840 What will be the recursive calls? 36 00:02:16,230 --> 00:02:24,000 And make me write also the the main function that will check out and makes sure that the recursive function 37 00:02:24,120 --> 00:02:25,530 works as expected. 38 00:02:25,650 --> 00:02:28,440 And then, of course, we are going to solve this exercise together. 39 00:02:28,710 --> 00:02:29,760 So I'll see you there. 3691

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