All language subtitles for 16. Exercise 2 - Number of Lines in a file [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
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

So in this solution, I will basically take the previous development that we had and I will just modify

it a little bit, OK?

So instead of count of characters, let's say new lines, new lines equals to let's say one word, let's

call it total lines, total lines in a file, we will initialize it to one.

And so what do we have?

We have a file and we want to know how many lines this file has or better say we can say how many new

line characters these file has.

OK, so we will keep up with our previous suggestion to read a character at the time.

And as long as we do so, we will ask if a given character equals to what?

What do you think is the indicator for working with new lines?

What specifies a new line?

You're right, it's the backslash in character.

So if we read from the file a backslash in character, then in this case what we should do, we should

say total lines plus plus.

Oops, I'm here.

So incrementing total lines by one, if we found out that we have a character that equals to backslash

Lashan because as we also already said at the end of each line here, although we cannot see a specific

and explicit backslash end.

But there is we also saw it in the previous video that we worked with, counting the characters.

You've seen that the backslash was there.

So there is a backslash in here.

So whenever we would see a solution, we get to a new line.

So that's what we want to count the number of times we've encountered the backslash and character.

All right, so then we will say the total number.

The total number of lines in these file.

Is.

What is the total number of lines in this file that we specified total lines.

That's eight guys, so build and run it.

Let's see that it works exactly as we expected.

The total number of lines in these file.

Three, we can also modify it.

I don't know.

Let's copy and paste.

And they had a new line, Lolla, and see that now we have like seven lines.

Let's see that it supports also they separate.

So the total number of lines in this file is seven.

Awesome.

Congratulations.

Good job, guys.

So, yeah.

We will move on.

Good luck.

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