All language subtitles for 10. Generation of Numbers 123...seq length

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

OK, so in the previous video, we talked about a function that receives a number, OK, which represents

the length of a sequence and then the function should calculate OK and return a sequence of nine.

OK, some new number, which will be compromised only of nines in a given length of that will represent

the sequence.

So, for example, we had like something like this.

So length equals to three.

If the function receives a number three, then it returns nine nine nine.

If it receives length equals to five, then it returns five times nine and so on and so forth.

We also discussed some of the things that should be taken into account, like using a long type and

so on and so forth.

But regarding the logic, it really doesn't matter how we calculate the number itself.

And basically we've seen that the result is just to take and use some for a loop started from equals

to zero up until Islands' the length and then on every duration to take the previous number multiplied

by 10 and add a nine to it.

OK, so we've seen all of these examples in all of these explanations and know what I want us to do

is simply a little bit to take this exercise into kind of upgraded and do modified and to give you some

time to think about some additional variation of this solution, of the logic being that is going on

behind the scenes in this exercise so that it will get you all again to your next level.

So let's start.

And first of all, we have to do is just to modify the excess, this exercise.

So once again, the function is going to receive some number, which is length, OK?

And basically this length should be of two to two options.

OK.

The first option is basically if length is less than or equal to nine.

OK, then in this case of the number that should be calculated and returned should look like this.

One, two, three, four, five, six.

Up until a given length.

OK, up until length length.

OK, so that's the new number that should be returned.

So that's option number one and else.

All right.

Else if length is, if length is greater than ten, which means it can be two digits or more, then

what should be returned is once again the nines.

OK, nines.

How many times until you reach this length.

OK, length times.

So for example, let's make some example.

If we get the length of three then the number that should be returned is just one, two or three, which

is one hundred and twenty three.

If length is five, then the number that should be recurring is like this.

But if we receive the length that looks like this, I don't know, like 12, then in this case the number

of returns should be like 12 times nine.

So how is it one, two, three, four, five, six, seven, eight, nine and 10, 11, 12?

OK, so that's basically the whole process and the whole idea behind what this exercise should do.

OK, so bear this in mind and basically take a few minutes.

I think 10, 15 minutes is also a good time for your practice.

And once you are done, let's proceed and do this exercise and the solution together.

Awesome.

So first of all, let us a little bit a little bit just modify our exercise and let's just for the sake

of simplicity, continue with the previous option that we had using the long type.

OK, so long.

And let's call this function OK, let's call this function.

How should we call it, let's say two one two one two nine one to nine.

And this function is going to receive a number.

And this number is going to be, again, length.

OK, and now in these function, we know that the body of the function, first of all, we need to understand

how we even print all these numbers.

One, two, three, one, two, three, four, five.

Basically, the idea is pretty much the same.

OK, we will start with, let's say, Nomikos to zero.

And then we know that, for example, length is equals to three.

Then in this case, we know that number will be multiplied by ten plus one.

In this case, it will give us one number equals to the previous number, which is one plus multiplied

by ten, which is ten plus two.

And in this case, it will be twelve.

And then we go again and we just add three.

And this will give us what you did.

Give us one hundred and twenty last three, which is one hundred and twenty three.

OK, so the logic is pretty much the same, just that in these examples where we use like adding a nine

every time, basically if we want to make a number, a sequence of of digits just with nines, we simply

add a nine and multiply the previous number 10.

And in this case, we also multiply number by ten, but we just add some different number like one,

two, three and so on and so forth.

OK, so I hope the logic behind it is now clear to let me know if you've successfully found out this

information by yourself and you came to this conclusion by yourself, if not a guy, that's not a problem.

But you need to kind of to think a little bit more and to devote more more time to coming up to at least

one or two options and then see if they really suit your solution.

Awesome.

So now let's proceed.

And now we know that long are one to end should basically give us all this information.

So the logic is going to be pretty much the same.

So let's create time and then creating now equals to zero.

And yeah, basically it's not going to be and it's going to be long because we are using a long time

to store longer values, so long term equals to zero.

And now we are going to run for equal to zero as long as it less the length I plus plus the only thing

that we need to to check is some condition that was part of our exercise, which said if length is less

than or equal to nine, then in this case this is the sequence we will return, OK, otherwise we will

return the sequence of nines.

So if.

If length is less than or equal to nine.

OK.

And of course, it should be greater than zero that some base condition that I'm not going even to add

here, because I think you you already know that OK, should be something like this.

If length is less than zero, then preened or starved and so on.

OK, so if length is less than or equal to nine, then in this case what we will do is just to execute

these for a loop.

OK, so let's just do it like this.

So for a loop, if that's the case, we are going to execute this for a loop.

And inside of these for loop, we are going simply to use a very similar technique to what it was used

previously multiplied by ten plus.

And the question now that remains is plus what should be used here?

Should it be plus nine?

Should it be plus one, plus two, plus three and so on?

So what do you think?

Take a moment, think about it and let me know.

Here is the example.

Look at the example and think what should we add here?

So now that you're back, basically think about that.

If you would have just used a like now multiplied by ten plus one, then the sequence should will be

in this case only if all the numbers from a sequence of ones, if you were to have used here two, it

will be a sequence of twos of threes and so on and so forth.

But you want something that is changing that on the first iteration, it's one on the second iteration

is two and the third is three and so on.

So that's why you will use here.

A variable that changes on every duration in this variable is none other than I.

So in this case, you will take these I and you will specify here.

But you know that on the first iteration, you don't want to take the value of zero.

You want to take the value of one.

Then in this case, it will look something like this.

I plus one.

So is that clear why we're using that, because on the first iteration, it will be like not multiplied

by ten plus one, on the second iteration, it will be equal, equal to one.

So it will be multiplied by ten plus two and so on and so forth.

And then you will come up to this kind of solution on the example that we've just shown here.

OK.

OK, so they've conditioned if it if it is true, if length is less than or equal to nine, then we

calculate now in this way and otherwise else what we should do about the ls basically about the else.

We should simply copy all of this solution.

Right.

All of this part.

We can also copy and run these for a loop here, or basically we can update these nine number a little

bit to using also the long type.

So it will look like this.

And now what we will do is just to use this function.

Then we will say now equals two nine number for the given length.

OK, and that's basically it for this exercise.

We are going to call this function that we've written on another exercise on another day of your work,

let's say, and you're using a totally different function to create one function which is updated and

different a little bit.

So that I think that this is a very important point that you should bear in mind.

Like, you create one function and then you use it for another function and then you proceed to create

like your program in your system that utilizes a bunch of functions that some of them were developed

by you, some of them not.

OK, so I hope that's clear to you.

And the last thing that remains is simply to return now.

OK, so now would have been calculated either here or here by calling the other function.

So now we can go you can run an example using the void main function, the main function to use some

number.

And yeah, basically this is just make sure that you do not use an integer here as a result because

you're using Cura long and you have to print it a little bit differently.

Percentage, these should be pretty much, I think, what you need right percentage the instead of just

the percentage LD like long integer.

So thank you guys for watching.

My name is one, this is Alphatech and I will see you in the next videos.

Until then, have a great time.

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