All language subtitles for 015 Exercise Four (Solution)_en

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

All right, welcome to exercise number for this coach had printed diagonal, but if you run it, it

prints a line of stars.

Whoever wrote this code didn't do a very good job.

Now, at first glance, I'm not entirely sure how we're going to use the counters, A.J., to achieve

the desired output.

So what I'm going to do is use breakpoints to visualize the runtime and hopefully then I can observe

some kind of pattern.

So I'll launch the debugger.

Step through it.

OK, so I know that at this point I need to start a new line to stay consistent with the output, but

this inner loop runs 10 times.

It should only run once during the first pass and twice in the second pass, three times in the third

pass, etc., So the amount of times the inner loop runs depends on the outer loop index, not a static

value of ten.

So we'll put J is smaller than or equal to I.

And after the inner loop runs to completion, will print a new line.

Kate, let's try this out.

And the first pass is going to be a zero.

Jay is going to start at zero as well, so they're going to equal each other.

This condition is going to be true.

The inner loop runs once.

Now, just one, the inner loop breaks, starts a new line.

And now in the second pass, the inner loop is going to run twice.

Until Jay exceeds the outer loop index.

Prince, a new line, and eventually we're going to get our pyramid.

OK, cool.

Now, we don't want a pyramid, we want a diagonal.

So how are we going to do this?

Once again, I'm going to visualize the run time and hopefully I can see some kind of pattern.

OK, so it's fine if this one prince.

In the second pass, I don't want the first loop to print anything.

But we want the second interlude Apprentice star.

In the third pass, I don't want the first loop to print anything.

I don't want the second loop to print anything.

But we want the third in the loop to print star.

Now, I think I see the pattern when the inner loop counter equals the outer loop counter, that's when

we want to print the star.

So let's put our condition.

If Jay is equal to I.

We're going to print the star.

Run the code now.

Wait, what happened?

Let's visualize the runtime.

OK, so here Jake was I.

So it should print.

In the second pass, when Jay, smaller than I, nothing happens.

But when the indices are equal, it prints star.

I see, even though we can't print a Starwind Jay less than I, we still need to provide the empty space

needed to print the pyramid.

So we're going to add an statement.

Otherwise, when J is less than I.

We're going to print three spaces.

All right, let's see how this would look.

OK, so here Jay is equal to I, so we should print.

And the second pass, when Jay smarter than I print an empty space.

But when the indices are equal, it prints a star.

Now, the inner breaks moving on to the third pass.

I to zero prints and empty space, another empty space.

Princess Star, and if you keep going, eventually you're going to achieve a very nice diagonal.

As expected, it works beautifully.

We just debugged exercise number for.

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