All language subtitles for 4. Check if a number is double-digit or triple-digit - Solution

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
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 back.

My name is Vlad, they self attack and let's solve our previous exercise that you should have tried

solving on your own.

And now once you're done, let's do this exercise together.

So first of all, what we need to do is to create some no.

Right.

What we are checking is simply if a given no, if a given number is double digit or if it is a triple

digit, triple digit, triple digit or if a given number is neither of them.

Right.

So that's what we want to check out.

So for that, let's create our variable.

And this variable is going to be, let's say, no.

OK, now we are going to print nice message for the user to the screen, so please enter a number.

OK, and now we are going to release information using percentage since we are working with integers

and stories inside the address of variable number.

OK, good.

Now, once we have the variable number, we should start thinking of what should be the conditions to

print if it's a double digit, triple digit or neither of them.

So one thing that you need to understand is that all the numbers, let's say we are even talking just

about the positive numbers.

OK, so it's going like this one, two or three, so on and so forth.

And there is a point when you reach 10 and then you go like 11, 12 and so on and you reach ninety nine,

ninety nine, then you have your one hundred, one hundred and one and so on up until nine hundred nineteen

point ninety nine.

OK now afterwords you have one thousand, one thousand and one and so on.

So that's basically if we take a look at all the natural numbers from one up to, I don't know, two

very large numbers.

And what what's special about it?

If you take a look at these sequence of numbers, what can you conclude out of it?

What can you see what patterns are like are feasible for for you maybe that are basically that we are

talking just about positive numbers and that's OK.

OK, because we could also use negative numbers.

But in this example for simplicity, I would only use positive numbers.

So the question here is, if we see one, two, three and then 10, 11, 12, the data and so on, what

you should notice is basically some condition that says if it's two digits number, OK, if it's a two

digit number, there are a couple of options, a couple of conditions to check that.

And the first condition is very simple.

It goes like this.

If number is greater then than what we think about it, then 11 or 10, what should it be if it's greater

or equal to ten or right.

Or the logical operator or or is it less than or equal to 99?

Then in this case, we can definitely say that this number is a double digit number.

Right?

This number is a double digit double that's go.

This is a double digit number.

Right.

So this number has to digitize.

And this condition is true because if the number and we know we work with integers is greater than 10

or equal to ten or is less than or equal to 99, then it means it's in this range.

OK, so it's from 10 up to ninety nine.

And you can see that all the numbers here, all the integers, the natural numbers are from 10 up to

99.

OK, so that's one way to solve it.

I'm not sure that I will show you all the ways, but let's just proceed with this exercise or else OK

else else if what is the second thing that we need to check if it's a triple digit.

Right.

So if the number is greater or equal to 800.

Right.

The first leftmost, let's say, smallest triple digit number or the number is less than or equal to

two what, two if thousand or two.

Nine hundred ninety nine.

So since we are using lisick.

Well, is he saying we should take just nine hundred ninety nine, so if that's the range in this case,

we should simply print that this number is a triple digit number, so triple digit number also.

But if it was not in invis range from 10 up to 99 and also it was not in the range from one hundred

up to 999, then in this case, what should we do?

What should we do this?

Should we print some last message or or and I'm just just giving you some time to think about it.

Is this condition OK?

Is this logical operator is OK?

I mean, if you didn't stop to think about it, at least for a moment, if this condition is OK or not,

then probably you have you have to change a little bit your attitude for these exercises in these course,

because a lot of things that I say you don't have not neither are the things that I say and nor the

things that your teacher says.

Don't take everything just as granted.

OK, think about it.

Think about what I've written here, because I've made some mistake here and I've used the logical operator

or OK, and I just went with the exercise.

Is everything okay?

So basically that's not okay.

And why is that?

What will be the case and what will be printed if we simply received here, for example, let's say

now equals to five.

OK, so not equal to five.

So if NUM is greater or equal to ten, this is false or Nahmias less than or equal to 99.

This will be probably truer.

Right, because five is less than or equal to 99.

Then in this case we will have this number is a double digit number.

We will have this this message printed to the screen.

That's not the case.

That's not what we want since we know this number is one digit.

And also what will be the case for one thousand and five, we will see that this condition happens to

be true.

Right.

But it shouldn't be true because we should not let 1005 be printed as a double digit number, because

that's not the case.

So pay close attention to what you are being taught and always be kind of curious about whether what

you've heard is true.

Or maybe the teacher has done some mistake, sometimes on purpose, sometimes not on purpose.

So what my what I said just use simply always be very like very paying attention.

And here, if we go back to the exercise, what we need to do is to kind of make sure that

basically previously, if we take a look now, is greater or equal to 210.

It goes like from ten to all the numbers on it's right.

If it will be either of these numbers, the condition will return.

True.

And also if it will be less than 99, up to whatever numbers will come, even if there will be negative,

it will be also true.

So what we want to do is to limit the range from ten to ninety nine, just these range.

And that's something you can do by using the logical end operator.

So the numbers should be great or equal to ten.

And also it should be less than or equal to a ninety nine.

So that's how you change it, that's how you pay attention to the small details and that's basically

the difference in the exercise and in the solution.

So we can say that,

that that's the first.

The first section that's the first section of the two digit numbers, that's the second section of the

three digits number.

And finally, we will say that if it's not in this section and also it's not in this section, then

we definitely can bring the following line.

So Printout, what was it?

Neither of these number is neither, let's say double digit nor triple digit.

Right.

Digit.

OK, so it may be less than 10 and also it may be greater than a thousand, OK?

Greater or equal to a thousand.

So that's basically how we solve this exercise and let's build and run it to see that everything is

working as expected.

So please enter a no.

What was it.

Twenty two.

So this number is a double digit number.

Let's enter the next one.

Let's to one hundred and one triple digit and also let's use it with five.

So this number is neither a double digit nor triple digit.

And finally, let's use, I don't know, something like this.

So this is also not a digit or a double digit nor triple digit number.

So I think this condition is very simple to find the section that you are interested in.

Also, you may also find if this number consists just of one digit, the condition is going to be pretty

much the same.

And yeah, basically this is it for this kind of solution.

But of course, there are also additional solutions where you can use just the just using the division

operation and dividing your number, for example, by 10.

OK, and if you are getting some result that these in some reasonable range, that then you can assume

that your number is a double digit number or if you divide it by one hundred and then you receive some

value, which is in the range from from one to nine, then you can assume that this number is a triple

digit.

But that's a whole different condition and that's basically a different program.

Both of them will work.

But this was just the first option.

You can try the second option on your own.

And yeah, this is it for this video, guys.

Thank you so much for watching.

Keep on practicing and I will see you in the next videos.

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