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 start solving this exercise, and I'm just getting the template from the solution of the previous
video where we talked about what was it?
It was something like this or printing the following pattern.
Right.
Let's just make sure that it's exactly what I'm talking about.
So let's go with the council.
Let's use and equals the three.
Yes.
So we printed out one, one, two, one, two, three.
And what we want to do in these exercises is the little we modify the pattern itself.
It's still going to be a right angle triangle, but the pattern of the values at each line is going
to be slightly different.
So here we have the template of the code from our previous exercise.
And let's simply start thinking about what should be modified in this solution so that this way we may
satisfy these conditions.
So what will happen?
We need to print the value of one just one time on the first row and the value of two, two times on
the second row and three and so on.
So we need here, let's say that we have like I is already equals to two.
And then in this case, we need to print.
We need to be equal to to write in printed two times.
So we need to print the value with say we need to print the value of I write because I equals to two
and we need to run this operation just two times.
So that's OK.
We will run it time.
So J no, it doesn't matter what is the value of J.
Of course J will be will start from one.
Right.
That's the initialise phase and will run up to AI which is two.
OK, so J will run two times and we will print the value of AI.
OK, ok.
I think we are getting closer so I'm not sure that that's the final solution.
But let's try to build and run it OK.
And see what happens.
OK, so that's also one way of working.
It's not usually recommended and like to build and run it when you are not sure for a hundred percent
that that's your optimal solution.
But sometimes when we have very similar exercises, for example, like this exercise is very similar
to the previous one, then in this case, I'm I'm giving you the option to to do this.
So let's run here three.
And yeah, basically we can see that everything works correctly and we have here the value of one,
two, two, three, three, three.
And let's just make sure that if we used different values, everything seems to be working correctly.
So one, two, two, three, three, three.
And basically, yeah, everything seems to be working just perfect.
So, yeah, another option that some of you probably thought about is maybe to use it for a loop in
inside of these for a loop to use a while loop.
So that's also an option.
And let's think about how it can be used.
So we need to print AI the value of ay ay times.
Right.
So we can say that let's say J equals to J equals to.
I write and we will say as long as J is greater than than zero, then in this case we will print the
value of Pi.
So let's go like this in here, specify the value of AI.
So let's see what happens and let's go with the value of five.
Then we have a problem.
So let's find what is, what is the problem.
So it's probably an infinite loop.
Right.
And we know that in this case.
In this case, we know that the value of G will be forever greater than zero and the slope will be executed
always.
So what we need to do is just to try using J minus minus.
So let's build and run it once again.
Click on this button and let's see what will happen.
So now let's go like five in here.
There you go.
You can see your solution on the screen once again.
Let's run it again with another value and see that it's working exactly as we expect.
Yeah.
Basically, that's the pattern that we expected it to be.
And you guys, this is it for this video.
We introduced the concept and talked about the concept of for loops inside of four loops, basically
using nested loops.
And we also saw how we can take an inner loop of while into use it inside for a loop and how we can
take it for a loop and use it inside of an.
For aloof and also there is no problem using a while loop inside of a while loop.
But one thing that you need to take to to bear in mind is that there should be some reason, some logic
behind this usage.
OK, there there will be no not all the exercises require you to use nested loops, but some of the
exercises will require you this knowledge and understanding of using nested loops.
So once again, make sure you understand everything.
And if you still have some questions, feel free to ask them.
And yeah, until next time, guys.
Good luck.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.