--Originally published at M E R I N O
Variables:
First, we have to know what is a variable?
In programming, a variable is a value that can change, depending on conditions or on information passed to the program
-WhatIs.com
Now, we know what is a variable but… How do I assign it?
To assign a variable you just need to add the equal sign (=) that’s it, you now have a variable… Kinda.
Also you can do multiples assignments like this:
Or assign the same value to different variables like this:
Types of variables:
There are 6 main datatypes of variables.
1- Numbers:
In this category are 4 “subcategories”:
- Integers (int)
- Long Integers (long)
- Floating point real values (float)
- Complex Numbers (complex)
Here are some examples:
![captura-de-pantalla-2016-09-11-a-las-20-37-28](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-20-37-28.png?w=736)
![captura-de-pantalla-2016-09-11-a-las-20-38-17](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-20-38-17.png?w=736)
2 -String:
In a string variable you can add any type of characters, number, symbols letters, you only need to add “” and write whatever you want, like this.![Captura de pantalla 2016-09-11 a la(s) 20.40.43.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-20-40-43.png?w=736)
3- List:
In this variable you can add various values to a single variable, you declare it with [] and separate the values with a ” , ” like this![Captura de pantalla 2016-09-11 a la(s) 20.49.27.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-20-49-27.png?w=736)
![Captura de pantalla 2016-09-11 a la(s) 20.50.01.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-20-50-01.png?w=736)
Then you can choose the value you want or the range of values. For a single value you only write between the [] the number in which the value is positioned, be careful because in Python, the first value is the value 0
![Captura de pantalla 2016-09-11 a la(s) 20.50.41.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-20-50-41.png?w=736)
![Captura de pantalla 2016-09-11 a la(s) 20.51.09.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-20-51-09.png?w=736)
![Captura de pantalla 2016-09-11 a la(s) 21.03.25.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-21-03-25.png?w=736)
![Captura de pantalla 2016-09-11 a la(s) 21.03.42.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-21-03-42.png?w=736)
To remove an element from the list, you can use del list [#] or you can use list.remove (“value”). It only takes out the value but the sequence keeps going with the next value . Here is an example:
![Captura de pantalla 2016-09-11 a la(s) 21.07.45.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-21-07-45.png?w=736)
![Captura de pantalla 2016-09-11 a la(s) 21.08.02.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-21-08-02.png?w=736)
Also you can change or update the values of a list, like this:
![Captura de pantalla 2016-09-11 a la(s) 22.16.10.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-22-16-10.png?w=736)
![Captura de pantalla 2016-09-11 a la(s) 22.16.35.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-22-16-35.png?w=736)
4 – Tuple:
A Tuple is like a list, but less flexible and instead of using [] we use (). You can’t replace values. Example:![Captura de pantalla 2016-09-11 a la(s) 22.04.52.png](https://rodrigomerinos.files.wordpress.com/2016/09/captura-de-pantalla-2016-09-11-a-las-22-04-52.png?w=736)
5-
Continue reading "You’re not my Type sorry" →