Learn Python | Data and variables

computer programming


Save information in a Python program

We will have the opportunity to detail the different types of numerical data later on. But before that, we can already discuss a very important concept.
Most of the work done by a computer program consists of manipulating data.
This data can be diverse (anything that can be digitized, in fact), but in the computer's memory it always ultimately comes down to a finite sequence of binary numbers.

In order to access the data, the computer program (whatever language it is written in) makes extensive use of a large number of variables of various types.
A variable appears in a programming language under any variable name, but for the computer it is a reference designating a memory address, i.e. a precise location in the random access memory.

A specific value is stored in this location. This is the data itself, which is therefore stored in the form of a sequence of binary numbers, but which is not necessarily a number in the eyes of the programming language used.

It can in fact be almost any object that can be placed in the memory of a computer, for example:
an integer, a real number, a complex number, a vector, a typographic character string, an array, a function, etc.
To distinguish these various possible contents from each other, the programming language makes use of different types of variables.

Variable names and words not usable

Variable names are names that you choose yourself quite freely. However, try to choose them well: preferably quite short, but as explicit as possible, so that it is clear what the variable is supposed to contain.
For example, variable names such as altitude, atlit or alt are better than X for expressing altitude.

A good programmer should make sure that his instruction lines are easy to read.
In Python, variable names should also follow some simple rules:
A variable name is a sequence of letters ( a through z, lower or upper case) and numbers 0 through 9, which must always begin with a letter.

Only ordinary letters are allowed. Accented letters, cedillas, spaces, special characters such as $,# ,@, ect. Are forbidden, except for the character _
Case is significant (upper and lower case characters are distinguished).
Get into the habit of writing most variable names in lower case (including the first letter).

This is a simple convention, but it is widely followed. Only use capital letters inside the name itself, to increase its readability, as in tableDesMatieres.
In addition to these rules, you should also add that you cannot use the 33 reserved words below as variable names because they are used by the language itself.

words used by Python programming language

words used by Python programming language.