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
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
Hey, guys.
And welcome back.
In this section, we'll be focusing on some key concepts of Python programming.
Variables, comments built in data types and operators.
Let's start off with variables.
What is a variable?
How to declare a variable and how to use variables in Python.
A variable is one of the fundamental concepts of any programming language.
We use variables to store the data.
The application is working with a variable is nothing more than a label or a name for a memory.
Location where a value which can be manipulated is stored.
To be more concise, I'd like to give you a simple example.
Let's suppose you develop a simple script that converts miles to kilometers.
When running the script, it will ask for the number of miles.
Then the user will enter a value, let's say ten, and the script will give the corresponding value
in kilometers, which is 16.9.
By the way, one mile equals 1.69 kilometers.
The value ten entered by the user.
Will be saved by the program in a variable somewhere in the memory.
To be more precise, in the RAM memory.
All variables are saved in RAM memory.
So we can define a variable is a name for a memory, location or address that stores the value.
In our example, then a variable has a name and is the variable word implies the value stored in it
can be changed.
I'm creating a new Python script in picture.
In Python, you can simply create a new variable by typing the variable name, the equal sign in the
value that will be stored in the variable.
For example, miles equals ten.
This creates a variable named Miles that stores the value ten.
The variable was created the moment you first assigned a value to it.
Now, if you want to modify the value stored in the miles variable, you write miles the equal sign
and the new value, for example, 15.
We won't go into details now, but we'll have a long discussion about immutable and immutable variables,
which means what happens with the variable when we change the value stored in it.
You can also declare multiple variables on a single line like this one comma, B, comma C equals one,
comma two, comma three.
And I'm printing a B.
SC.
By the way, print is a python function used to display messages onto the screen.
You give it a variable or a message as an argument, and the function will display it on the screen.
And I'm running the script.
You can see the values of A, B, and C or H, Co my name equals.
30 comic John.
John in single quotes.
I've created two variables a variable called edge that stores the integer value of 30 and another variable
called name that stores a string or a sequence of characters with the value of John.
By the way, if you add one or more species at the beginning of the line before the variable name,
you will get a syntax error.
This is a syntax error because I added a whitespace.
Indentation is part of the syntax in Python and all instructions belonging to the same block of code
should have the same indentation.
Indentation refers to the spaces at the beginning of a code line.
I'm removing the white space.
Often you will see terms as defining a variable, declaring a variable or initializing a variable.
In other programming languages, for example, in C or C++, there is a very clear distinction between
declaring and defining a variable.
The clearing means introducing a new name and type, for example, in miles.
Which means a new variable called Miles will be created and it will store an integer value.
And the defining means allocating a value to that variable.
For example, miles equals ten.
By the way, this is not valid Python code.
In Python.
We don't have such a distinction because we don't explicitly specify the type of data the variable will
store.
A variable is also sometimes simply called a name and can store any type of value, a whole number or
integer, a floating point number, or simply a float or a sequence of characters or a string, a list,
a reference to a file, and so on.
Och, we are done for the moment.
In this video we've learned what a variable is and how to declare a variable in Python.
We'll take a short break and in the next video we'll go over naming conventions for variables.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.