Python command's interpreter launched by the command with the same
name. The prompt >>> shows when the interpreter waits for a command. Another
prompt … tells the user that the next command will belong to the current
block. A block of command ends generally by an empty line. The
tutorial's examples use the interpreter prompts to make the difference
between commands and their output.
A comment in Python begin with a # (cardinal) and finish at the end of line.
# This is a comment
variable's names are case sensitive. The variable Toto is not the same
as TOTO. A variable exists only when assign. The assign gives
the kind of variable and its value. Assigns an existing variable allows
the change of its type.
>>> A=0 >>> print A 0 >>> A+=1 >>> print A 1
>>> A=0 >>> a=2 >>> print A 0
>>> A=0 >>> print A 0 >>> A= "titi" >>> A+=1 "cannot concatenate 'str' and 'int' objects"
An integer variable is created by the assignment of an integer or by the int() function.
>>> A=0 >>> print A 0
>>> A=int("0") >>> print A 0
A floating variable is created when the formula assigns contains at least one floating number or by using the float() function.