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
All right, exercise number five.
If we look at the output, it seems like we want to get some kind of pyramid that skips every second
row and prints the letter that follows.
Let's hope the code that we have print anything remotely similar.
And what the heck is this?
We definitely have our work cut out for us.
OK, where do we start?
You know what?
I have no idea.
So I'm going to do is just place a bunch of break points and just try to see why this code is behaving
the way that it is.
OK, so the first part of the outer loop is one, I imagine this two is not zero skipping the statement
and as soon as we enter the inner loop, A gets converted to another letter before it has the chance
to get printed.
That's not right.
If you look at the output, we need to print the letter A..
So what I'm going to do is start by moving this after the print function.
All right, let's try again.
OK, just not smaller than I, so it prints the letter A, OK, and now if I look back at the output,
I need to start a new line, but this inner loop is going to run ten times before the next new line,
which is not what we want to do.
So right there, by visualizing the runtime using breakpoints, I've already identified the second bug.
So once again, the amount of times the inner loop runs depends on the outer loop index, not a static
value of ten.
So we'll change that.
And OK, I think we might be on to something.
Let's run the code.
Hmm, it's skipping a whole lot of letters that can't be good.
Let's relaunch the debugger.
OK, we're fine here.
So at this point, I equals two and it's about to set this run.
Equals three.
Oh, I see every time it prints an empty space, it also increments the letter.
So this line should be in the outer loop, not the inner loop.
All right, restart the debugger.
Prince, the letter A.
Skips the next one.
And that's all.
Good job on debugging, exercise number five.
This was definitely not an easy one to debug, but we made it.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.