= 2
x print(type(x))
print(x)
<class 'int'>
2
Congratulations, you are already probably familiar with numbers!
In Python, there are two kinds of numbers: integers and floats. Integers are whole numbers without a decimal component, while floats have decimal component (even if it is X.0):
When dealing with large numbers, it may be helpful to visually separate using underscores. These variants are treated as if the underscores were not there:
It is no surprise, we can use Python as a glorified calculator, to perform arithmetic operations:
It is possible to round numbers using the round
function: