Variables


General Concept


Before diving into coding it’s important to assimilate few computer programming concepts like the one of a variable, which is a reserved memory location to store values. It gives data to the computer for processing. Each variable in python has its own datatype. In a script we have multiple variables, each one containing different memory to be processed.

A program can have multiple variables, each one containing different memory to be processed. The memory location is identified by a unique name called identifier. The value stored in a variable can be changed during program execution.

Variable are the building block of the program. They are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It’s our building block to organize our code so that it achieves its purpose.


Variables in Python


The first line shows the python synthax to create a simple variable containing the text information (the second line contains a *function” print() which takes that variable and print its value in the terminal).


Copy variables


Now, variable can also be copied:


Correct synthax


Variables in python must be written in a proper way. Some of the following naming will work but it is not considered very pitonish. Use only lower-snake-case for variables e.g. my_var, and capital-snake-case for constants e.g. CONST (variable that must not change value through out the script)