All language subtitles for 6. Challenge 1 - Solution 2

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 basically, we were asked to write a program that will get as an input from the user to variables

current year end users age and then make some calculations on these two variables.

But let's leave that aside for now and just focus on the first part.

We need to get as an input to values for our two variables.

And then the previous videos, we've said that if we wanted to use variables in our program, then the

first step to do is to create them, to declare them.

So that's exactly what we're going to do right now.

So let's first of all, declare these two variables gained current year.

Right.

It's the first variable.

And let's declare also the age variable int age.

Both of them are of type integer.

The first name is current year and the second name is age.

So at this point, these two variables are kind of empty.

They contain no real value at this point.

And one of the options to set their values is to use assignment and to give these values.

I don't know something manually, for example.

We can use current year, current year equals to 2020 and age equals to 30, as we used in our example.

And that's exactly what we don't want to do.

We should read these values from the user and not to sign them manually as we're doing here.

So the first thing that we do is scan F, scan F, all right.

Percentage the Y because we use two variables of type.

And then we use a comma ampersand and current current year.

Right.

That's how we scan F as an input from the user.

The current year.

And also let's do the same for the age scan of percentage.

The ampersand age.

This once again, once again means the address where the variable age resides.

All right.

So take the value from the prompt from the console application, read it and put it inside of these

variable.

All right.

So in this way, we'll be able to read these values from the user.

So there are different.

Users will be able to insert different values in a more generic way.

So now at this point, at this line, at this line, for example, line twelve, after the two scan

F lines and all that remains now is to calculate and print the results, to print the year you were

born to the screen.

So to bring something to the screen, we should use the print.

The print if function.

Right.

Print F.

All right.

So what should be we should we be printing for this screen.

So we should be printing something like that.

You were born in percentage the backslash n right.

To get one line down.

And here we should use our expression to find out the exact year that you were born.

And that could be done just by subtracting can be current.

The age of the current year, current year minus age will give us the exact year that the user were

born, was born.

And there you go.

Now we can build and run this program and see their results on the screen for ourself.

So let's build it and run it.

All right.

So now let's place first of all, we need to enter the current year, for example, 2020.

All right.

And now the prompt waits for the age we should also put here at the age, let's say, as we've done

in our example, 30, let's press enter.

And now you were born in nineteen ninety nine.

Oh, so that's cool.

You can actually find the year that you were born.

Let's try another example, let's say.

All right.

Let's say so.

The year right now is 2020.

And for example, you are 57 years old.

Let's say 57.

Press enter and we can actually find out at the year that, for example, your father or grandfather

was who was born.

You were born in 1963.

Great.

All right.

So we've successfully completed our challenge.

And by the way, some of you may have also tried some other ways, some other solution by using an additional

variable to hold the calculated value of the birth year.

So you probably used something like this after you declare a variable.

Another variable called birth year.

Right.

And then before.

You printed out something on your screen, you just use something like death, birth year equals to

these to this guy, right?

He goes to these guy and then instead of writing any mathematical expression here, you just use the

birth year.

Right.

Something like that.

And that's totally OK.

You should work the same way.

We simply previously didn't use any additional variable as opposed to this example where we created

another temporary variable that helped us with this calculation.

But if any of you solved the sex or size with the additional variable like we've seen here, there is

nothing wrong with it.

It simply will work.

It will simply work the same way.

So this is it, guys, for this video.

I hope that everything runs on your side as well.

Right.

Relevant nodes for you from this challenge.

Different examples, different ways we solve the sex or size and preparing herself for the next challenge.

I'll see you there.

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