All language subtitles for 13. Chars To 3 Digits Integer

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

Original subtitles

So welcome, and in the previous video, we started to talk about different of exercises that we're

using, but we're using ASCII characters and in this video we will continue OK, and we will create

a new function that will also work a little bit with ASCII representations.

So let us start.

So what we have to say first is that we know that there may be a lot of different characters, like

a lower case, a lower case, B, OK, lower case, lower case B, uppercase F, we have characters

like this.

We have characters like that.

Right.

There are many, many, many characters that we can use the results of a character, which is a space

character and so on.

And also what we know that there are characters which are simply represented as digits.

OK, so there is one which is also a character or two, which is also a character and so on.

Up until zero and nine.

Right, there is nine character.

If you take a look on your keyboard, you will also see the zero character, right?

So there are many characters.

Of course, one hundred at least one is not a character that's a string.

It's something I think we haven't spoke of so far.

But that's definitely not a character.

But all of these, they are simply characters and they can be also stora this characters, although

the number the integer one can bestor it is an integer, but here one also can be stored as a character

in the different scene in.

The fact is that you can store one very variable with the value of one as an integer and then it will

consume like four bytes of memory.

And also you can store there's a character to and it will be stored just as a character with consuming

just one bit of memory.

And there is also a difference.

You cannot like add one character to another and expect a fully mathematical operation.

Right.

That's not the case.

It's not how it's going to work.

It's simply stored.

There's a character that you press from your keyboard.

Okay.

So I hope that makes sense so far.

And if we were, we would have taken a look at the ASCII table.

You will see that there is also and ASCII character representation for all the digits from what what

we want.

Let me check.

It was from zero, which is correct.

The representation of zero, which starts from the decimal representation of 48 up until nine character,

which is the representation of fifty seven.

So we know, we know these pretty much that the character is zero corresponds to the decimal representation

of the value of 48 48.

And we know that it goes like this up until the correct representation of nine, which is basically

fifty seven because they are all stored or basically placed one after another in kind of a sequence.

OK, so that's the character.

That's each death.

That's equal representation in in the memory of the computer.

Awesome.

And now what do we have to do is simply to write a function?

OK, so that's our task, to write a function that receives what a child receives, what he should receive.

It should receive three characters, OK, three characters.

And these characters basically should be just numbers and just the digits.

OK, so basically we should also check if the characters are digits or if all the characters are of

a digit type of a digit type, meaning they are from zero up to nine.

Right.

Each character, then in this case the function should return an integer, which is the decimal representation

of this number.

OK, so we should return an integer, which is a decimal representation of this representation of these

three digits number.

So for example, let's use the examples here.

Example, if we would have received like three characters like this one, five and five and nine, then

in this case, what we would have to do is simply to return to where it is here, to return the value

of an integer, a type of one hundred and fifty nine.

OK.

So notice we do not return a character or something like that.

We simply return one fifty nine.

So that's one example, if you would have I don't know, like a two zero and six and six, then in this

case you would have to return like two hundred and six.

OK, so return two hundred and six.

Very simple also.

And basically if one of the characters are which is the otherwise case here.

Right.

If not all the characters are a of a digit type, then what you have to do is simply return zero.

OK, so what I mean by that, if you will receive one character, which is let's say these these characters

are, then definitely you cannot calculate in return some number associated with that.

Right.

So if that's the case, you should simply return zero.

OK, so I hope the instructions are clear to you guys.

Take a few moments to think about it.

And of course, we will solve that exercise together right away.

But please give it a try.

Try it on your own.

Don't jump right away to do the solutions.

Otherwise it will not give you as much knowledge and as much understanding is as you would have done

and tried to solve it by yourself.

So take your time.

No rush.

This video is here and I am going to see you in the solutions.

Awesome.

OK, so once you have tried to solve it on your own, that's a good time to start solving it for ourselves.

OK, so let us start and call these function.

I don't know.

Let's call it character.

Let's call it two digits, not a digital integer.

OK, characters two integer and least function should receive what you did get should get three characters.

So let's say cha cha boom.

Let's say character one char.

Character two and char.

Character three.

All right.

So that's the signature of the function.

And the reason why these function returns an integer is because we said that we want to take the information

stored in each of these characters and to construct a three digit number, which will be of an integer

type and then simply to return it.

So how should we go about that?

So basically what I recommend is to understand, first of all, that we need to check.

OK, we need to check that all of the characters are, first of all, are represented as digits.

And one way to do so is just to use one if condition.

So if let's say if and we will ask director one is greater than zero and character one is less than

or equal to nine, then that's OK, right.

That's OK.

We can also do the same thing for character or two and character three.

Is that clear.

So far, good.

So we can start with just this explanation.

So if character one is greater than zero in character one is less than nine, then it means it's in

the legit range.

So of course, guys, there are plenty of of options to solve this exercise.

I'm going to show you just one.

So no worries.

If you've done it a little bit differently, just make sure that the expected result is pretty much

the same.

So let's create let's create, um, let's create just for simplicity.

We will create three variables.

It's not mandatory, of course.

What we will create three variables and we will say the first variable will be hundreds.

The second variable will be what it should be.

Each should be tense and the third variable is units.

And of course, we will create like a final result.

OK, final result.

Awesome.

So we know that the first character, a character one, is related to the leftmost character.

So in this case, we will simply say that the hundreds will be equal to what do these characters.

So this will represent are the digit, the leftmost digit, which is associated with the hundreds.

So hundreds will be equal to character one minus what, minus the zero representation, which is kind

of the the.

The lowest between all of these characters, from zero to nine, since they are in a 16 sequential manner,

so pretty much just like our examples to lower, into higher, into upper.

We are doing the same thing here.

So if character was like to OK, the character was still so two minus zero would give us a total result

of two and it will be the decimal representation, which is exactly what we want.

OK, so we are going to take a look at ah let's go with this example with this one.

So we are going to take this one character.

OK, the one character, it has a representation, the decimal representation of what it was off of

the day to day of forty nine.

So it's going to be forty nine minus forty eight, which are the decimal representation, which is a

total of one.

So hundreds will be equal to one.

OK, so intolerants equals to one and then we are going to proceed with if of course the ls here the

ls for this condition is return zero and basically and this exercise right it right away.

And then we are going also to do pretty much the same job for a character or two.

So each character or two is greater than zero.

And also if Keryx or two is less than or equal to nine, then in this case we will know that the hundreds

that 100th the test should be equal to character and two minus the decimal representation of character

is zero, which in this case we take these five and we know that 10 will be equal to five.

Right.

And of course, the VLCC is again return zero.

OK, because if one character, at least one character is not in this range from character to zero,

up to nine, that's not something that we want.

And finally, we have also if character character of three is greater than or equal to zero and also

character three is less than or equal to nine, then in this case we will say that the units will be

equal to character, a three minus zero.

OK, guys, in this case it will be simply nine right from this example.

Else return return zero also.

So we found out the hundredth representation, the dance and the units, and we have to return the final

result and the final result should be calculated in the following way.

You know, this is one.

This is five.

This is nine.

So we have to return.

We have to return hundreds multiplied by a hundred.

Right.

Since that's hundreds plus tens multiplied by by what, by 10 and plus units.

OK, so you will go you take this one multiplied by 100.

So it will be 100 plus tens, which is five multiplied by ten, which will give us one hundred and fifty

and plus nine, one hundred and fifty nine.

So that's the characters to integer function.

If you still have any questions, feel free to ask them.

And until the next time, keep on practicing, keep on moving forward and you are bound to succeed hopefully.

Yeah.

I wish you a great day, guys.

Goodbye.

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