While a division operation you have two types of data, float and integer. Python returns float an integer division like 4/2=2.0 and not directly 2. This is a new property included with python3. If you want your result from division returns an integer, use double slash //. Check the example.

To have remainder from a division we use % sign. Remainder of 13 divided by 4 is 1.

13 |4

12 |3

1

To have power of a number we use ** sign, 4^3=64

Operation sequence

We use same mathematical order while calculating with python.

  • Operations within a parantheses are considered first.
  • Multiplication and division have priority against addition and substraction.
  • Calculation is done from left to right.

Back