Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
Hi again, in this lecture I'll show you
how to do math operations with numbers.
3
So we're going to look at math operators.
Let's go straight away and open a Python
5
section and let me write a math
expression there. 20 minus 10 divided by
7
5 times 3 in the power of 2 and what we
get is 2.0. So why did I write this a
9
long expression? Well because I want to
explain to you the order of operators so
11
when you have multiple operators in an
expression the one to be executed
13
first is the exponent, so we have 3 in
power of 2 here that will give us 9.
15
So power is the first to be executed and
also that is division and multiplication.
17
Actually division and
multiplication are on the same level.
19
We're talking about order but the one
that is first will be executed first so in
21
this case division is the first one so
what will happen here is Python will
23
ignore minus for now,
so it will divide 10 by 5 and it will
25
give 2 then it will do 2 times 9.
So again 10 divided by 5, 2 times 9, 19.
27
And then we have the rest of the operators
which could be a plus or minus so in
29
this case we have minus so 20 minus 18.
We have 2.0. You'd ask why we have 2.0?
31
Because 10 divided by 5 gives 2.0.
So division outputs a float in Python 3.
33
If you are on Python 2, it would output
an integer. Now to make your expressions
35
look better, you'd want to remove the
spaces for the power operator and also
37
you do like that somehow you can read it
better,
39
so 2 times 9 and then 20 minus 18 and so on.
You get the idea.
41
You get 2.0 again and now if you want to
execute the minus operator first
43
you'd want to put that inside brackets.
So why did we get 18? Well because 20
45
minus 10 gives 10 and then 10 divided by
5 gives 2 and then 2 times 9 gives 18.
47
That's the idea. And then you could also do
this, put these in brackets and what
49
would happen here is you know 10 here,
15 here in the power of 2, so 15 in the
51
power of 2, and then 10, so 10 divided by
15 in the power of 2. Let's see what we get.
53
Yeah we got that, so let's see if I was
55
Right.
15 in the power of 2 we get 225.
57
And then we got 10 on the other side, so 10
divided by 225. We get that number.
59
So whenever you want to change the
order of operators, you should use
61
brackets and so I hope you get the idea
and please try this out, so try to do a
63
few operations with numbers to get used to it.
And yeah, I'll talk to you later.
65
Thanks.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.