Python - Maths

add numbers
Random numbers
Square numbers
the % symbol (remainder of a number)
Division

add numbers

in interactive mode run the following to add the number 2 and 3 and then add the results to 1 (use underscore for the last printed expression)

>>> 3 + 2
5
>>> _ + 1
6

random numbers

from random import randint
hiddennum = (randint(0,10))
print hiddennum

square numbers

5 ** 2 # is 5 squared so 25

the % symbol (remainder of a number)

% remainder from a division
math is calculated from left to right, unless you put in parentheses
>>> 1 + 2 * 3
7
>>> (1 + 2) * 3
9
division

division
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 10/3
3
>>> from __future__ import division
>>> 10/3
3.3333333333333335
>>>

or

>>> 17 / 3
5
>>> 17 / 3.0
5.666666666666667