All language subtitles for 012 Numbers-subtitle-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
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
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
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
sk Slovak
sl Slovenian
so Somali
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

Great, now let's learn numbers. Let me

open an interactive shell here to

3

explain this faster and so numbers, you

know what numbers are. To create a number

5

just type the number in python and

that's it and you also have operators

7

like this is the plus operator and you

can also store numbers in variables

9

let's say a equals to 2, b equals to 3

and then if you do a plus b you get 5.

11

Something to note is that you know if

you do that in here, a equals to 2 b

13

equals to 3, and then if you just do a

plus B and then you execute the script,

15

let me open another terminal, you will

not get any output in there. The reason

17

is that you are not printing out

anything in your program, so this is

19

different from an interactive session.

Here if you simply do an operation or if

21

you simply call a variable like that, you'll

get the output promptly, so this is just

23

for simplicity when you when you try

things out, so you don't have to pass

25

print explicitly, but Python will

understand that you met print. But here

27

things are more strict, so you if you

want to print out the output, you want

29

to say print a plus b and then execute

and you get the output and yeah basically

31

that's the only difference between

executing a program from a Python file

33

and running the code in the interactive

shell, so these are numbers and I can

35

prove that if I do type 2 for instance.

You'll see that this is an INT

37

type which means is an integer, so

basically we have integers and we have

39

floats. These are the two main types

of numbers.

41

A float is, let's say 2.4 it's a float

and I can prove that 2.4,

43

type 2.4. You'll see that this

is a float, however if you do type 2 in

45

brackets you'll see that this is a

string, it's not a number and therefore

47

you cannot make operations using a

string and a number so Python will give

49

you a type error and this is saying

cannot convert integer to string

51

implicitly so when you do a string plus

something else Python expects that you

53

were adding another string after a plus

sign, so that's why it says I cannot

55

convert integer object, so it cannot

convert this to a string implicitly

57

because if you were to do two plus three

you'd get 23 because Python treats these

59

two as text. So to understand it

better

61

let's add some text here b so you get

2a3b, so it's a concatenation operation.

63

When the plus operator is used with

strings it is referred to as

65

concatenation. Now let's go back to our

sample program that we used earlier

67

which was this one in here, so now what

if instead of getting a greeting from

69

the user you ask their for their age?

Enter your age, so this is just a message

71

you can write anything you want there,

but just try to have a message that

73

makes some sense to the user and so also

I'm going to change the variable name to

75

something more meaningful, age and then

what I want to do is let's say new age,

77

I want to calculate the age plus 50.

Why not?

79

I'll print out the new age. Save the

script and let's go and execute this, we are

81

going to get an error here I warn you.

But it's good that you see the errors

83

that you get because that's how you

learn better.

85

So Python my program, execute.

For now it's working fine because what

87

happens is Python executes a script

line by line so it goes to the first

89

line and if there is no error it

executes that line and in this case we have

91

an input function so the program is on

standby mode so it expects from the user

93

to enter the input, so let's enter the

input here. Let's say 28 and here is the

95

error that we get. So again we saw this

error before. This is saying type error

97

cannot convert int object to string

implicitly and you also have the line

99

here that the error occurred. So these are

important messages and line two in here.

101

So what's happening is that age is a

string it's not a number therefore

103

python cannot add up a string with a

number and so why is age a string?

105

Because that's what the input function

produces, so the input function get the

107

user input and converts it to a string

so even if you pass a number there these

109

will always convert everything to a

string.

111

Therefore Python you know cannot

concatenate 28 plus 50 so what can you

113

do in that case? Well you want to convert

that string into an integer and for

115

that you want to use the int function,

so it's a Python function that does the work.

117

As you can see it outputs now

the correct output so 28 plus 50 equals

119

78 and similarly you can convert

numbers to strings

121

and let's say str 50 and I think we'll

get an error here. Yeah, it says type error.

123

Unsupported operand type four plus.

So you're adding up an integer with a

125

string, so integer with a string. If you

like to convert this to a float, let me

127

remove that, save, execute. 28. You get

78 point zero because what

129

Python does when you use float is you

know float 28, it converts it to 28.0.

131

So floats can be useful in certain scenarios.

And you'll have a lot of scenarios in the

133

course, so don't worry about that now

because we have real world

135

applications later on where you see the

real benefit of everything that you are

137

explaining here in this early sections

that cover the basics. So this is about

139

numbers. Try to practice them a little

bit and I'll talk to you in the next

141

lecture.

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