All language subtitles for 18. Exercise 3 - Writing numbers and their powers to 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
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,670 --> 00:00:02,980 So let us start the solution, shall we? 2 00:00:03,580 --> 00:00:07,130 So let's create a pointer, F.P., a pointer to a file. 3 00:00:07,480 --> 00:00:12,760 Let's open it up and let's make sure that it was opened up successfully. 4 00:00:13,480 --> 00:00:17,810 Now, let's use here some let's use some loop, some for a loop. 5 00:00:17,830 --> 00:00:21,760 Let's create additional variable AI and we'll use it like this. 6 00:00:21,790 --> 00:00:26,470 So for I equals zero, the one in this case. 7 00:00:26,470 --> 00:00:26,680 Right. 8 00:00:26,680 --> 00:00:29,610 Because we know zero in the power of zero. 9 00:00:30,040 --> 00:00:30,730 What does it mean. 10 00:00:31,180 --> 00:00:32,470 Well what, what will it be. 11 00:00:32,770 --> 00:00:36,790 So I equals to one eye is less than what did we want. 12 00:00:36,790 --> 00:00:38,110 We want up until 10. 13 00:00:38,110 --> 00:00:46,040 So let's say equals small less than or equal to ten and then we will say a plus plus one every duration. 14 00:00:46,330 --> 00:00:48,040 And now what we are going to do. 15 00:00:49,130 --> 00:00:57,650 We need a way to take the information stored inside these variable eye and put it inside the file, 16 00:00:58,550 --> 00:01:05,960 and also we need to put the information from I multiplied by so we could weigh a good function would 17 00:01:05,960 --> 00:01:10,920 be in this case is the print F function file, print file. 18 00:01:11,360 --> 00:01:13,460 What does he expect to receive? 19 00:01:13,460 --> 00:01:16,250 It expects to receive a pointer to file. 20 00:01:16,860 --> 00:01:20,300 Let's give it F.P. and then what should we give it. 21 00:01:21,580 --> 00:01:27,930 We should give it a second is the Charr format, so what will it be? 22 00:01:28,300 --> 00:01:33,060 What are the placeholders in this case we should use here person the unique. 23 00:01:34,080 --> 00:01:39,500 OK, I just want to show you a simple example of just using the percentage deal without the powers themselves, 24 00:01:39,690 --> 00:01:41,000 so let's use it like this. 25 00:01:41,490 --> 00:01:48,450 So we will write to the file all the numbers, one, two, three, four or five, six, seven, up until 26 00:01:48,450 --> 00:01:49,680 we reach some value. 27 00:01:49,970 --> 00:01:52,170 So let's wait up until we reach them. 28 00:01:52,170 --> 00:01:57,170 So let's say the coalition run it and let's hope that everything will work. 29 00:01:57,210 --> 00:01:58,510 Where is the file? 30 00:01:58,530 --> 00:01:59,040 Come on. 31 00:01:59,040 --> 00:01:59,820 Come on, come on. 32 00:02:00,240 --> 00:02:00,880 Here it is. 33 00:02:00,900 --> 00:02:01,720 Here is the file. 34 00:02:01,740 --> 00:02:04,200 One, two, three, four, five, six, seven, eight, 10, nine. 35 00:02:06,040 --> 00:02:07,270 Eight, nine, ten. 36 00:02:07,670 --> 00:02:15,320 Yeah, absolutely, so what we want now, these files to have is something like this one for nine and 37 00:02:15,320 --> 00:02:15,810 so on. 38 00:02:16,610 --> 00:02:17,670 So what should we do? 39 00:02:18,170 --> 00:02:21,140 We should basically update the printer offline. 40 00:02:21,830 --> 00:02:28,040 So instead of using just percentage D, we will use percentage D the number and then we will specify 41 00:02:28,040 --> 00:02:32,650 a space and we will use another number specified by percentage. 42 00:02:33,380 --> 00:02:33,950 That's it. 43 00:02:34,370 --> 00:02:38,180 Here we will specify I multiplied by I which is. 44 00:02:39,630 --> 00:02:48,780 Which is which is why do you think it is I it is the power of two or five, so let's run it and hopefully 45 00:02:48,780 --> 00:02:51,860 everything will work smoothly so we can finish it up. 46 00:02:51,870 --> 00:02:57,060 So one, one, two, four, three, nine four, six, five twenty five, six and so on. 47 00:02:57,840 --> 00:03:04,410 So I think you've got the idea and if you would like to make like to expand it a little bit, very easy. 48 00:03:04,650 --> 00:03:11,310 Just Adelaida know up until a hundred and there you go, you will have your file with all the values 49 00:03:11,310 --> 00:03:13,800 of I and I square. 50 00:03:14,950 --> 00:03:15,610 Awesome. 51 00:03:16,240 --> 00:03:18,950 So, yeah, this is it for this video. 52 00:03:19,450 --> 00:03:27,190 We used the printer function, specified the file pointer, specified some format specifications, including 53 00:03:27,190 --> 00:03:32,440 placeholders specified I, I multiplied by AI and that's it. 54 00:03:32,920 --> 00:03:34,780 So thank you guys for watching. 55 00:03:34,930 --> 00:03:36,120 You're doing great. 56 00:03:36,130 --> 00:03:38,170 And let's move on to the next video. 4978

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