All language subtitles for 14. Exercise 1 - Number of characters 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 welcome back.

And now basically what we would like to do in this solution is simply given this text file, OK, we

would like to read it and the way we are going to read it is using the F Getsy function to basically

read character by character until we reach the end of the file.

OK, so how will it look like we will create a pointer called FP, a pointer to file and we will use

FP equals to f open reading these file then we will ask FFP does not equal to now.

Then it means that the file was successfully opened.

What would we like to do here?

What do you think?

If we use just one f getsy then probably what we are going to get is just one character.

So we use Algazi, specify the pointer and let's create also additional variable to store our characters.

So let's say Char Maija.

We will say it like this, Maija equals to f getsy F.P..

So this will read the first character, but that's not something that we want.

We want to basically on every iteration to read a character until some condition is met.

And what is this condition?

This condition is until we reach the end of the file.

So how can we specified?

Let's let me show you.

So while while and we will say until we don't reach some condition, which is the end of file and we

have these special EAF and a file specifying we reached the end of the file.

So that's basically also take these Maija inside of these while statement.

Don't don't get scared.

It's not so complicated.

So let's go like this.

Let me explain you in just a second what we've done here.

OK, no worries, guys.

So.

What do we have here?

We have my car getting assignment and input from F. Getsy F.P., getting a character from the file one

after the other and deles while until you reach the end of the file, that's it.

Read a character from a file until you reach the end of the file.

And on every iteration, what I want you to do is to print the character to the screen.

So my char.

My char.

And that's basically all there is to it.

OK, just we need to add the count, but I want to first of all, to run this program to show you that

it works.

OK, so hi, this is Vlad from Alphatech.

And what can you notice here?

You can notice that my getting character one at a time, it also gets characters like H e y and then

he gets characters like space and then it also gets characters like Backslash N.

Because if it wouldn't get the backslash and characters, the new line characters, then what would

happen here is that all of the text from the file would be just in one line.

And you can see that by using these print F percentage C and the backslash.

And right here we jump to the next line, to the next line and so on and so forth.

So the backslash was read carefully.

And finally, I also wanted to create some counter.

So end count of characters equals to zero.

And in this case, every character we are going to count, it's a complex place.

And finally, we will print.

I don't know, the total of characters in the file.

In the file is percentage, the backslash in percentage.

They will be replaced by count of characters.

And that's it.

So let's run it and hope for the best, so, OK, here, we also need to get a better solution, right?

Because at the end of the file, there is no backslash and it ends on just one line.

So it will look like there's no here.

Come here.

There are a lot of characters in the file is 32 and if you will count them up, they should match,

including the backslash and probably.

Right.

So, yeah, this is it for this video.

Guys, thank you so much for watching.

Keep on practicing.

Keep on moving forward and you are bound to succeed until next time.

My name is Vlad.

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.