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
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

Original subtitles

1

Throughout this course,

2

we'll be getting you involved in a lot of these interactive coding exercises.

3

And the idea is that you are not just sitting here watching me talk, that you are

4

actually putting everything you're learning into practice. That way

5

it actually becomes your own.

6

These coding exercises are great because we can give you instructions and show

7

you what should happen if you write the correct code, what it needs to do,

8

and you'll be able to write your code as well as see it run in the console.

9

And it's through a lot of these exercises that you're going to level up and

10

you're going to become a better coder. So in order to enroll,

11

head over to this URL, and if you don't want to type it in,

12

you can head over to the course resources and you will be able to get a direct

13

link there.

14

And the first thing I want you to do is to go ahead and click on the fork

15

button. Now,

16

the important thing here is this is the output that we want to see down here in

17

the console. And when you hit run, this is what should happen. Now,

18

remember that I want you to have exactly the same characters printed out as I've

19

got here, including where the spaces are, including the symbols,

20

like these single quotes, et cetera.

21

Now is the time for you to head over to this challenge and try to complete it.

22

Pause the video now and complete this challenge.

23

...

24

All right. How did you get on?

25

I really hope that you gave this a good go because it's in these moments where

26

you're going to be learning to code. Unfortunately,

27

no amount of listening to me talk is actually going to give you these skills.

28

It's only when you actually try it out and get the computer to do the thing that

29

you want it to do. That's when you become the master of the computer,

30

also known as the programmer. So in this case,

31

the instructions are pretty simple.

32

We have to use what we learned about the print statement to output these three

33

lines. And notice how in this gif,

34

the lines are printing out in separate lines.

35

This one gets printed, then this one, then this one.

36

But because it happens so fast,

37

it seems as if they're getting printed as a single block.

38

So we're told to write our code below this line.

39

And we know that in order to print something,

40

we use the print function with a set of parentheses. And inside the parentheses

41

is where we tell it what we want it to print. So in the first instance,

42

it's day one, a space,

43

then it's... now it's really easy to make spelling mistakes,

44

but I really encourage you to actually type out anything that you put into your

45

code rather than just simply copying and pasting it. Now,

46

of course, it works exactly the same way. I could just copy and paste the code in

47

here, but it's often in these cases where you make mistakes,

48

like for example,

49

forgetting to add the double quotes around the text that you want to print.

50

I really recommend just typing out the code for practice whenever you are doing

51

these code challenges. Now,

52

the last line that we want to print is a little bit complicated.

53

It's almost like print inception,

54

because what we want to print is this function.

55

This is how we write our function.

56

And that has to go inside here, inside a set of double-quotes.

57

So let's open up a double-quote and then write our print statement.

58

And in this case, I'm actually using a single quote

59

and I'll tell you just in a little moment why that is.

60

So let's add that single quote and finally, the closing parentheses.

61

This now is the entire code that you would need to be able to print something

62

out. And when I go ahead and click run,

63

you can see that the output looks exactly the same as what we've got here in the

64

GIF. This is what we want. And I've now completed the coding challenge.

65

Now, coming back to this single quote,

66

why is it that I've got a single quote here rather than a double quote,

67

which is what we've been using all this time? Well, because in Python,

68

it doesn't actually care whether if you enclose the strings,

69

so these pieces of texts are not to be interpreted as code inside a single

70

quotes or inside double quotes.

71

It is identical to the computer. This Honeybadger literally doesn't care.

72

But if you had a set of double quotes and then you wanted another set of double

73

quotes inside the double quotes, so for example,

74

if I replace this with double quotes, you'll see that already,

75

the syntax highlighting is already screaming out to us. There's something that's not

76

quite right here because the colors are not the same as here where the print

77

function is in a particular color,

78

the parentheses are in a particular color and the text that is to be printed

79

is in a yet another different color. In this case,

80

it looks all jumbled up and we're getting some errors here.

81

So now if I hit run, you'll get syntax errors.

82

And the problem here is of course,

83

this-- is of course our code thinks that the end of this string is here.

84

And so it doesn't know what on earth is going on afterwards. And instead,

85

it's seeing this as a string, this as a string,

86

and this is being interpreted as code.

87

So when we want to use some double quotes inside another set of double quotes,

88

commonly you'll see people switch to single quotes instead.

89

So you could, for example, write the print statement like so,

90

and use double quotes if you want to print those out,

91

or you can do it the other way which is what I had before

92

where we use our double quotes on the outside and single quotes on the inside.

93

So have a play around with that if that's at all confusing,

94

but once you've tried it a few times and switched it around a few times,

95

it should become clear what it's actually doing.

96

How did you get on with this challenge? If you ever need to see the solution,

97

it's always down here as a link.

98

So if I go ahead and paste that link into my browser,

99

then you'll see, word for word, the solution to each of these challenges.

100

And hopefully that'll help you along the way while you're learning as well.

101

So I hope you enjoyed this challenge. In the next lesson,

102

we're going to get back to learning about Python and we're going to learn about

103

strings and string manipulation. For all of that,

104

and more I'll tell you there.

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