Numbers in Python

There are two main types of numbers in Python that you need to be aware of as a beginner Pythonista.

Integers

Integers are positive or negative whole numbers. Integers do not include decimal numbers. You can assign a variable to a whole number and then use that variable to return the number.

Examples of integers

2, 89, -450

Floats

Floats are numbers that include a decimal point. Floats do not include numbers that do not include a decimal point i.e. integers.

Examples of Floats

2.54, -98.0

Operators

You can also add, subtract, multiple or divide two numbers, either integer or float together by using their variables:

 

 

 

 

 

 

 

There is also an extra operator called floor division (//) which will round down a division that isn't a perfect integer: