Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
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
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
0 To calculate the average of these grades we want to see if a list type has some sort of mean or average 1
method that allows us to get the average of its values. 2
For that we go to check with dir list. 3
So list is the name that represents all lists. 4
So that is the type. 5
And this is an instance of that type, of the list type. Dir list and let's have a quick look here. 6
Do we have a mean or average method? 7
I don't think, so so there's no methods of the list type to allow us to calculate the average of a list 8
values. 9
However that doesn't mean that it doesn't exist 10
a mean method in Python to do that. Mean or average 11
it's not a method, but it can be a function. 12
You remember the print function so print like that. 13
You see that print doesn't need the dot notation to be used like for example the upper method did need 14
a dot notation because upper is a method attached to the HELLO type and print is a function, it is an 15
independent function that works with many types, not only strings, not only integers, float. 16
You can print anything with print. 17
That's why it's not attached to a specific type. 18
So where do we see a complete list of functions that we can use. 19
You can do that using dir again underscore underscore built ins underscore underscore close parentheses. 20
And that is 21
a complete list of what you can use built in functions and also types in Python because here you also 22
see like the list word that we used an str, and that's basically what Python has 23
in a nutshell so these functions, and the methods of the types such as str, and least and so on. 24
These are actually the built in features of Python. 25
What comes with the Python installation. 26
We will see later that there are also libraries made by other people for example to process images. 27
To process pixels of an image. 28
Python doesn't have that because that that'd be too much to be included in the Python 29
default installation so people have come up with libraries which are still Python codes and we'll look 30
at that later. 31
So this external Python code that you can install as an add on, as an extension will allow you to make 32
more operations, but the built in Python is this basically. 33
So let me see for a mean function, or an average function. 34
No, it's not there. 35
Okay but there is a some function. 36
So what we can do is, let's say my sum, don't use sum as a variable name because you can see that sum 37
is a reserved keyword. 38
So sum(student_grades), that will give us the sum of these three numbers, and then we want to count how many 39
items there are in that list. 40
So do we have a count something there? 41
Maybe not. 42
Well I know that there's no count method but we have this Len. 43
Which means... You can check what it means. 44
So return of the number of items in a container. 45
So a list is also referred to as a container. 46
Let's say a length equal to Len. 47
Student grades. 48
And then finally we can get the mean which is my sum divided by length and printout the mean, save and 49
that is the mean value of all those three numbers.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.