The interpreter acts as a simple calculator: you can type an expression at it and it will write the value. Expression syntax is straightforward: the operators +, -, * and / work just like in most other languages (for example, Pascal or C); parentheses (()) can be used for grouping.
The integer numbers (e.g. 2, 4, 20) have type , the ones with a fractional part (e.g. 5.0, 1.6) have type . We will see more about numeric types later in the tutorial.
The return type of a division (/) operation depends on its operands. If both operands are of type , is performed and an is returned. If either operand is a , classic division is performed and a is returned. The // operator is also provided for doing floor division no matter what the operands are.
This variable should be treated as read-only by the user. Don’t explicitly assign a value to it — you would create an independent local variable with the same name masking the built-in variable with its magic behavior.
In addition to and , Python supports other types of numbers, such as and . Python also has built-in support for , and uses the j or J suffix to indicate the imaginary part (e.g. 3+5j).