All language subtitles for 10. EXTRA Milestone #1 - 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
hu Hungarian Download
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 let's solve this crazy exercise together.

And the first thing that we need to do is to create a great variable because we are going to read grades

from the user.

And we are going to store every time the graded we read inside of these variable and will assume that

the grades in these program are going to be of an integer type.

Right.

It's just an assumption.

So to calculate the average grade, we know that we need to some of the grades.

And that's exactly why we are going to create a some variable that sums all the grades that the user

inserts.

So eight total, let's call it total sum equals to zero.

And also, we are interested to know how many grades the user inserted because we do not know this much

in advance.

We only know it as we go.

So we will also create a variable called let's see how we will call it.

And let's call it grades.

Let's call it grades.

Count equals to zero.

And this variable will basically be present.

How many grades we have.

And these will represents the total sum of all the grades.

So if we would like to calculate the average grade in this case, we'll just think of the total sum

and divided by the grades count.

So now let's print some guiding message to the user.

So printout.

Please, please, please.

User, enter your grades, grades or enter a minus one.

Let's use it minus one to stop.

Okay.

A semicolon at the end.

And now we will use Scarn F scan F to read the grade and put it inside of the variable rate.

Okay.

Now we do not know in advance how many grades we are going to use.

So that's why we are going to use a while loop until we reach the stopping condition of grade equals

two minus one.

So as long as these condition, as long as grade is does not equal to minus one, we are going to execute

the loop body.

And in the loop body, we are going to sum the grades that we've inserted.

So total sum, total sum will be equals to the previous total sum, total sum, plus the grade that

we've inserted so far.

And we know that we found this sum.

And also we need to f whenever we read a new grade, we need to increment the grades count by one.

So weights count plus plus.

And now once we are done with this calculation, we are going simply to copy and paste these two lines

inside of our loop, because on each iteration we would like to read another grade from the user.

So we read the first grade here.

Then we come in added to the total sum and increase increment the grades count and then we read the

grade once again.

And there we go over and over again.

We run these while loop body until until this condition is not met.

So when the user will enter a grade, which equals two minus one.

And we read that at this line.

So whenever he does it, we are stepping out of these wire loop and we are proceeding with our program

to this line.

It's length 20.

And at least line, we can simply print out the result and we can say that.

Let's first of all, Brent, have you have you have entered percentage?

We want to specify how many grades the user has.

Insert that so far.

So grades up.

I'm sorry.

In certain grades.

Right.

And a backslash.

And at the end.

In here we are going to use the grades count.

All right.

So this message will represent how many grades the user has inserted.

And now we are going to print the main event of this calculator.

We are going to print of the average grade that the user will have.

And hopefully that will be a good grade.

Right.

So let's do something like this.

And your and your average every each grade is percentage.

And that percentage D because we are calculating are the result of that a vision between different numbers.

And the result may be of a floating point in time.

So that's why we are going to use percentage F.

And we are going to add a backslash and to skip the line.

And here we are going to calculate the average grade.

So it's basically the total sum divided, divided by the grades count.

And just one thing to mention here, we should specify the casting of double because we want the result

to be of a floating point types or in a double float.

Just float.

And.

There you go.

You can see that these programs will read all the grade until it reaches the stopping condition of minus

one, and Vannett calculates your average grade based on the number of grading provided.

OK, so let's try to build it and run it.

And in this example, we are going to use, let's say the first grade is going to be 80.

The second one is 90.

And the third one is a hundred.

We are just getting better and better.

So now let's stop the calculation using minus one or a stopping condition.

Right.

Or minus one just stops or we press minus one.

Press enter and your average grade.

You've entered three grades, right?

Yes, 80, 90 and 100.

And your average grade is 90.

So basically, guys, you developed a program that you can share with all of your friends, students,

colleagues, family, and give them these tool that you've created that they can use it on your own,

on their own.

It's awesome.

You're getting better and better, although in this chorus it's going to be in these kind of console

application of these black screen black, black, black and blank screen.

In the future courses that you are going to take, you're also going to develop some graphical user

interface that will help you to build much more complex and beautiful programs that you will be able

to use to sell, do whatever you like with them.

So thank you guys for watching.

You doing great.

You keep moving forward and you are becoming much better programmer than you were yesterday.

I'll see in the next video.

Oh.

Oh, and one last thing to mention here.

One less thing that hopefully will not let your computer crash.

Is that either user.

If it happens that a user inserts on the first attempt a grade of minus one, then you're going to have

a problem.

We are going to skip this while loop and we are going to come over here.

We are going to print that.

You've enter it zero grades, which is through.

But the problem is that when we are going to try to print the average grade result, we are going to

divide the total sum, which is zero.

We are going to divided by zero.

And that's a problem, right, guys?

So make sure you can handle this thing carefully by just maybe adding some condition beforehand.

Maybe doing something like this save on grades count does not equal to zero.

So then run this line, otherwise print some other message.

Okay.

So this is it for this video.

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