All language subtitles for 006 [Interactive Coding Exercise] Printing.en

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 Download
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
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,570 --> 00:00:01,830 Throughout this course, 2 00:00:01,920 --> 00:00:06,630 we'll be getting you involved in a lot of these interactive coding exercises. 3 00:00:07,080 --> 00:00:10,560 And the idea is that you are not just sitting here watching me talk, that you are 4 00:00:10,560 --> 00:00:14,130 actually putting everything you're learning into practice. That way 5 00:00:14,160 --> 00:00:15,600 it actually becomes your own. 6 00:00:16,290 --> 00:00:21,090 These coding exercises are great because we can give you instructions and show 7 00:00:21,090 --> 00:00:25,200 you what should happen if you write the correct code, what it needs to do, 8 00:00:25,620 --> 00:00:29,220 and you'll be able to write your code as well as see it run in the console. 9 00:00:29,850 --> 00:00:33,750 And it's through a lot of these exercises that you're going to level up and 10 00:00:33,750 --> 00:00:37,170 you're going to become a better coder. So in order to enroll, 11 00:00:37,170 --> 00:00:40,650 head over to this URL, and if you don't want to type it in, 12 00:00:40,680 --> 00:00:44,220 you can head over to the course resources and you will be able to get a direct 13 00:00:44,220 --> 00:00:45,053 link there. 14 00:00:45,810 --> 00:00:50,280 And the first thing I want you to do is to go ahead and click on the fork 15 00:00:50,310 --> 00:00:53,310 button. Now, 16 00:00:53,370 --> 00:00:58,370 the important thing here is this is the output that we want to see down here in 17 00:00:58,770 --> 00:01:03,390 the console. And when you hit run, this is what should happen. Now, 18 00:01:03,420 --> 00:01:08,420 remember that I want you to have exactly the same characters printed out as I've 19 00:01:09,300 --> 00:01:13,620 got here, including where the spaces are, including the symbols, 20 00:01:13,860 --> 00:01:15,750 like these single quotes, et cetera. 21 00:01:16,260 --> 00:01:20,820 Now is the time for you to head over to this challenge and try to complete it. 22 00:01:21,900 --> 00:01:24,300 Pause the video now and complete this challenge. 23 00:01:24,440 --> 00:01:28,820 ... 24 00:01:28,910 --> 00:01:30,320 All right. How did you get on? 25 00:01:30,860 --> 00:01:34,700 I really hope that you gave this a good go because it's in these moments where 26 00:01:34,700 --> 00:01:37,150 you're going to be learning to code. Unfortunately, 27 00:01:37,220 --> 00:01:41,030 no amount of listening to me talk is actually going to give you these skills. 28 00:01:41,060 --> 00:01:45,590 It's only when you actually try it out and get the computer to do the thing that 29 00:01:45,590 --> 00:01:48,830 you want it to do. That's when you become the master of the computer, 30 00:01:49,040 --> 00:01:51,980 also known as the programmer. So in this case, 31 00:01:52,010 --> 00:01:53,510 the instructions are pretty simple. 32 00:01:53,660 --> 00:01:58,010 We have to use what we learned about the print statement to output these three 33 00:01:58,010 --> 00:02:00,230 lines. And notice how in this gif, 34 00:02:00,260 --> 00:02:03,140 the lines are printing out in separate lines. 35 00:02:03,650 --> 00:02:06,440 This one gets printed, then this one, then this one. 36 00:02:06,440 --> 00:02:08,270 But because it happens so fast, 37 00:02:08,510 --> 00:02:11,360 it seems as if they're getting printed as a single block. 38 00:02:11,900 --> 00:02:14,420 So we're told to write our code below this line. 39 00:02:15,230 --> 00:02:17,390 And we know that in order to print something, 40 00:02:17,420 --> 00:02:22,420 we use the print function with a set of parentheses. And inside the parentheses 41 00:02:22,910 --> 00:02:27,050 is where we tell it what we want it to print. So in the first instance, 42 00:02:27,080 --> 00:02:30,650 it's day one, a space, 43 00:02:30,710 --> 00:02:35,060 then it's... now it's really easy to make spelling mistakes, 44 00:02:35,360 --> 00:02:40,160 but I really encourage you to actually type out anything that you put into your 45 00:02:40,160 --> 00:02:44,360 code rather than just simply copying and pasting it. Now, 46 00:02:44,390 --> 00:02:49,390 of course, it works exactly the same way. I could just copy and paste the code in 47 00:02:50,300 --> 00:02:54,110 here, but it's often in these cases where you make mistakes, 48 00:02:54,170 --> 00:02:55,310 like for example, 49 00:02:55,520 --> 00:02:59,350 forgetting to add the double quotes around the text that you want to print. 50 00:03:00,010 --> 00:03:04,060 I really recommend just typing out the code for practice whenever you are doing 51 00:03:04,060 --> 00:03:06,670 these code challenges. Now, 52 00:03:06,730 --> 00:03:10,570 the last line that we want to print is a little bit complicated. 53 00:03:10,900 --> 00:03:12,730 It's almost like print inception, 54 00:03:13,030 --> 00:03:16,810 because what we want to print is this function. 55 00:03:16,930 --> 00:03:19,000 This is how we write our function. 56 00:03:19,600 --> 00:03:23,800 And that has to go inside here, inside a set of double-quotes. 57 00:03:24,190 --> 00:03:27,970 So let's open up a double-quote and then write our print statement. 58 00:03:28,540 --> 00:03:32,560 And in this case, I'm actually using a single quote 59 00:03:33,040 --> 00:03:36,310 and I'll tell you just in a little moment why that is. 60 00:03:37,180 --> 00:03:41,290 So let's add that single quote and finally, the closing parentheses. 61 00:03:41,710 --> 00:03:45,790 This now is the entire code that you would need to be able to print something 62 00:03:45,790 --> 00:03:48,670 out. And when I go ahead and click run, 63 00:03:48,700 --> 00:03:52,540 you can see that the output looks exactly the same as what we've got here in the 64 00:03:52,540 --> 00:03:57,400 GIF. This is what we want. And I've now completed the coding challenge. 65 00:03:58,060 --> 00:04:00,430 Now, coming back to this single quote, 66 00:04:00,520 --> 00:04:04,690 why is it that I've got a single quote here rather than a double quote, 67 00:04:04,720 --> 00:04:08,620 which is what we've been using all this time? Well, because in Python, 68 00:04:08,650 --> 00:04:13,650 it doesn't actually care whether if you enclose the strings, 69 00:04:13,900 --> 00:04:18,900 so these pieces of texts are not to be interpreted as code inside a single 70 00:04:19,330 --> 00:04:21,940 quotes or inside double quotes. 71 00:04:22,180 --> 00:04:26,830 It is identical to the computer. This Honeybadger literally doesn't care. 72 00:04:27,610 --> 00:04:32,610 But if you had a set of double quotes and then you wanted another set of double 73 00:04:33,790 --> 00:04:37,330 quotes inside the double quotes, so for example, 74 00:04:37,330 --> 00:04:41,710 if I replace this with double quotes, you'll see that already, 75 00:04:41,710 --> 00:04:46,270 the syntax highlighting is already screaming out to us. There's something that's not 76 00:04:46,270 --> 00:04:51,270 quite right here because the colors are not the same as here where the print 77 00:04:53,560 --> 00:04:56,050 function is in a particular color, 78 00:04:56,380 --> 00:05:00,550 the parentheses are in a particular color and the text that is to be printed 79 00:05:00,690 --> 00:05:04,210 is in a yet another different color. In this case, 80 00:05:04,210 --> 00:05:07,720 it looks all jumbled up and we're getting some errors here. 81 00:05:08,470 --> 00:05:11,980 So now if I hit run, you'll get syntax errors. 82 00:05:12,910 --> 00:05:15,220 And the problem here is of course, 83 00:05:15,640 --> 00:05:20,640 this-- is of course our code thinks that the end of this string is here. 84 00:05:22,810 --> 00:05:27,790 And so it doesn't know what on earth is going on afterwards. And instead, 85 00:05:27,820 --> 00:05:31,840 it's seeing this as a string, this as a string, 86 00:05:32,290 --> 00:05:35,380 and this is being interpreted as code. 87 00:05:36,400 --> 00:05:41,400 So when we want to use some double quotes inside another set of double quotes, 88 00:05:41,800 --> 00:05:46,450 commonly you'll see people switch to single quotes instead. 89 00:05:46,990 --> 00:05:51,130 So you could, for example, write the print statement like so, 90 00:05:51,580 --> 00:05:55,150 and use double quotes if you want to print those out, 91 00:05:55,720 --> 00:05:59,360 or you can do it the other way which is what I had before 92 00:05:59,780 --> 00:06:03,560 where we use our double quotes on the outside and single quotes on the inside. 93 00:06:04,070 --> 00:06:07,100 So have a play around with that if that's at all confusing, 94 00:06:07,460 --> 00:06:10,400 but once you've tried it a few times and switched it around a few times, 95 00:06:10,700 --> 00:06:12,800 it should become clear what it's actually doing. 96 00:06:13,580 --> 00:06:18,200 How did you get on with this challenge? If you ever need to see the solution, 97 00:06:18,230 --> 00:06:20,240 it's always down here as a link. 98 00:06:21,200 --> 00:06:24,230 So if I go ahead and paste that link into my browser, 99 00:06:24,260 --> 00:06:29,120 then you'll see, word for word, the solution to each of these challenges. 100 00:06:29,600 --> 00:06:32,990 And hopefully that'll help you along the way while you're learning as well. 101 00:06:33,740 --> 00:06:36,590 So I hope you enjoyed this challenge. In the next lesson, 102 00:06:36,710 --> 00:06:40,430 we're going to get back to learning about Python and we're going to learn about 103 00:06:40,490 --> 00:06:44,060 strings and string manipulation. For all of that, 104 00:06:44,300 --> 00:06:45,680 and more I'll tell you there. 10487

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