All language subtitles for 2. Print Rectangle of Asterisks - 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
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

Welcome back.

So I hope you've tried and solved this exercise successfully, and what we are going to do now is simply

do this exercise together.

So get yourself ready and make sure you check out everything you've written on your own and that everything

seems to be working correctly.

So now what we are going to do is simply to remove these print offline, because we know, first of

all, that we have to print some pattern that just looks like this.

Right.

So, Dan, what is it?

One five 10 asterisks are two in each row and we have a total of five rows just like that.

So one, two, three, four or five.

So that's the that's the pattern that we want to see printed on the screen.

Right.

Just like we've printed some numbers, we also can print some other characters just like these asterisks.

And that's exactly what we are going to do right now.

So what what do we have to do?

First of all?

First of all, we need to understand that we can do it in two ways and we can do it like to use a printing

command to print each line, each line to print with ten asterisks.

So, for example, it will look like this.

So print f, print F simply all these function does is to take some, let's say, string for now, some

bunch of characters and represent them and bring them to the screen so it will look something like this

or print F and one, two, three, four, five, six, seven, eight, nine, 10.

Right.

So and then we will add the semicolon at the end to specify that this command is over and complete.

All right, so we know that these come in printed just one line, so let's simply copy this line and

printed once again five times, right.

So we have here five rows.

And the question is, is this pattern that we can see right now here on the screen, will it be printed?

Exactly.

Just like this if we will build and run this program?

So let's build and check it out.

So build and run.

And you can see here on the screen that not we cannot see the whole pattern, although we can see a

lot of asterisks printed through the screen right now.

But it's not a lot of it's not actually the pattern of the rectangle that we wanted to print.

All of them are printed in just one line.

So one of the things that you have to understand is that after every printer here, we will use a backslash

and character that simply specifies that we are going to go one line below in the printed result.

So let's listen in.

There you go.

Let's build and run it once again.

And we'll first of all, we had all of the characters, all of these 50 characters on just one line.

And now hopefully we will see that pattern that we were expected by using these backslash m so these

backslash and you can see it right here after ten characters.

After all of these characters, there is a new line printed on this console application and after another

attempt asterisks a new line again.

And there you go again and again.

And basically you can see that that's exactly the pattern and the rectangle that you expected to see

in.

One main question that students ask me later on in the Q&A section is why did we have to use here five

printer commands?

So basically, couldn't we just take it?

And instead of using five printer commands, just combine all of them in just one print of command.

So take a second and think about it.

But the question is pretty obvious is that we can do it.

So what we will simply do is just take every 10 asterisk and put them inside here and put it back in

to an asterisk, a backslash n again.

And finally and what we have done here is simply specifying in one print of command instead of using

five, we simply specify that print have 10 asterisks after words print in your line.

Right.

Because we want to move a new line ahead and then print an asterisk once again, print a your line and

there you go again and again and again.

How many times.

Five times.

Right.

Because we have five rows and we have ten columns in each row.

And that's exactly what we are doing right here.

So let's build and run it once again to make sure that everything seems to be working correctly.

So there you go.

There is our pattern and basically two options.

You've seen how you can do it using five print F commands when each print off line simply represents

one row in the pattern or how you can do it just by using one print off-line, using these combinations

of properly putting these backslash and inside of the command itself.

So I hope everything is clear, guys, and I hope you're ready for your next exercises.

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.