January 2019
Beginner
318 pages
8h 23m
English
The Python interpreter can also act as a calculator. You just have to type an expression and it will return the value. Parentheses ( ) are used to do the grouping, as shown in the following example:
>>> 5 + 510>>> 100 - 5*575>>> (100 - 5*5) / 155.0>>> 8 / 51.6
The integer numbers are of the int type and a fractional part is of the float type.
Consider the following example:
>>> 14/34.666666666666667>>>>>> 14//34>>>>>> 14%32>>> 4*3+214>>>
To calculate powers, Python has the ** operator, as shown in the following example:
>>> 8**3512>>> 5**778125>>>
The equal sign (=
Read now
Unlock full access