All language subtitles for 008 [Interactive Coding Exercise] Debugging Practice.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

To begin,

2

I want you to locate the day 1.2 debugging exercise.

3

And now, as you did before, go ahead and read through the instructions.

4

Be mindful that the output must match the example output precisely.

5

And when you hit run, this is the outcome you're looking for.

6

So there's quite a few things broken here,

7

but I want you to have a go at fixing each line individually and pulling out the

8

bugs from the code. So pause the video now and give that a go.

9

All right.

10

So how did that go? If you haven't got your computer in front of you,

11

if you're traveling, if somehow you can't access the exercise, just pause

12

and when you've got time,

13

then complete the challenge and then come back to the course.

14

It is so important that you actually do some hands-on stuff.

15

And I stress that this is the only way that you are going to become the rock

16

star coder that I know you can be. Let's take a look at the code below.

17

You can see that when we run our code as it is right now,

18

we get a new error.

19

And this is going to point to the first of many errors in this file.

20

And in this case, it tells us that on line three,

21

so this one right here, at around this position

22

or somewhere around here, um, as denoted by the little caret sign,

23

there is a syntax error. If we study this closely,

24

you can see that the code highlighting seems to be suggesting that all of this

25

is code, but this is somehow text. So what's going on here?

26

Well, notice that we've only got one double quote.

27

So it thinks that what comes after this is the text,

28

but what comes before it, it thought it was just a continuation of code.

29

So to fix this one,

30

all we have to do is add a double quote right here. That changes the text to the

31

color that we're used to and this fixes this line.

32

So if we run our code now, we should get a different error. And indeed we do.

33

The next one tells us that on line five,

34

so this one right here, there is an indentation error.

35

There's an unexpected indent somewhere around here on line five.

36

So let's take a look at line five and there you go.

37

There's a little bit of extra space between the print and the beginning of the

38

line.

39

So now that we've fixed that one, let's click run. And it will point to

40

another line of code that's broken. And in this case,

41

it says on line seven,

42

which is here where there's actually no code,

43

there's the unexpected EOF while parsing. What does this mean?

44

Well, if you're not sure,

45

then go ahead and paste it into Google and let's take a look at what people say

46

on Stack Overflow. So as this person,

47

very kind, Felix, um, has explained, this index error

48

unexpected EOF

49

while parsing means that the end of your source code was reached before all

50

code blocks were completed. What is a code block? Well,

51

this is a code block because it's a print function,

52

it has a beginning and it has an end. But what does this line not have?

53

Well, it's got two open parentheses,

54

but only one closing parentheses.

55

So the computer thinks that you are going to continue writing something and then

56

close it off at the end, which is not the case. In fact,

57

what has happened is we simply have an extra misplaced open parenthesis.

58

And now if we delete that and hit run,

59

you'll see that we have everything printed.

60

But at this point, notice how on line four

61

which is the line that we haven't fixed yet,

62

it prints string concatenation is done with the 'blank' sign.

63

Whereas in fact, it should say plus sign.

64

And even though we don't see any errors being printed in our console,

65

you'll see that we have an output mismatch because I'm expecting to see this

66

line, the String Concatenation is done with the "+" sign,

67

but here,

68

the output doesn't have that part. It's missing this part.

69

So there's one last thing that you need to debug. And that is of course,

70

on line four.

71

And what's happening here is we have this part being interpreted as a string,

72

this part being interpreted a string,

73

and it thinks that this plus sign is just us concatenating

74

these two parts together,

75

which is why it printed out like this. But in fact,

76

we wanted to print out is this as text down here.

77

So what we have to do is to change this outer apart from double quotes

78

into single quotes.

79

And now you can see when it highlights this part,

80

it's all the same color including the plus sign.

81

Now it sees this as a complete string,

82

and it's not looking at this as if it's code. So now if we run our program,

83

you can see the entire sentence being printed out.

84

So if you've completed the challenge and you've gotten everything right,

85

then you're now done with this exercise.

86

If you got stuck and you want to have a look at the solution, as always it's down

87

here,

88

and it might be useful to have a look at this page to see where you might've

89

missed something or where you might've gotten something wrong.

90

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

91

we're going to learn about a new type of Python function,

92

which is the input function. So for all of that and more, 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.