Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So let's make this quick exercise together, guys, because previously we know that the previous exercise
when we had to write down a recursive function that gets an integer and returns one, if the sum of
all the digits in the received number is even otherwise, return zero if it's odd.
And basically we are going simply to modify it a little bit.
So return one.
If the sum of all digits in the received number is odd or otherwise return one, which means in the
case that this sum is even OK.
So very minor a change, very minor change.
In this case, it's going to be zero.
In this case it's going to be one.
In this example.
I just want to like to give it briefly for those of you who is who are interested, maybe some of you
got the idea and you don't have to watch these video to her to the fullest or basically not at all.
So.
I'm just going to modify it a little bit to give you this code like crystal clear.
OK, so if anything, less than 10 and basically that's the stopping condition.
And if that's the case, we know that it can be divided by two without the remainder.
OK, so this is an even number, right?
So that means even number.
And for an even number, we are going to return.
What are we going to return?
We are going to return one.
OK.
So in.
Yeah, what if it's an even number we're going to return, we are going to return here zero, so OK,
otherwise return zero.
In case that's an even number.
Awesome.
So if that's an even number, return zero.
And if that's an odd number, that's basically all the number we are going through a third one and the
result so far is going to be calculated on the similar manner.
OK, we are going to ask if An can be divided, basically the rightmost digit, if it's an even digit
and the result so far is one, then in this case what we will have to return.
What do you think?
If the result so far equals to one, then it means that the result so far is order.
Right.
And if the results so far resolved and this number is even then even plus odd is basically odd.
So that's why we have to return one.
And if the result so far was equal to zero, in this case it was even right.
And if it was even then, the result so far is even and we also know that the given value, the rightmost
element of the rightmost digit is also even then in this case even plus even will equal to even.
And that will mean that the return should be once again, zero.
OK, so here it's going to also stay the same.
OK.
The only fact that change is here is not the code itself, but rather just this understanding.
So if results of equals to one, then it means that the result so far was odd.
OK, otherwise it was even.
So that's basically just the way you look at the results so far and you don't have to change also these
returns.
So this exhibition or a demonstration, quick explanation is clear to you guys.
And of course, take your time, try to solve it on your own and we will see each other again on in
or.
Yeah.
In the next video until next time.
My name is Lisas Alphatech.
I'll see you then.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.