Python - Numbers
Code Life
By Pierre Marsaa
Numeric Variables - Numbers
Variables can hold different types of data. In this lesson, we will focus on the easiest ones: numbers!
Python has two main types of numeric variables:
- integers (int) : Whole numbers like 1, 0, 42, -42, -3
- floating point numbers (float) : Decimal numbers like 3.14, -0.001, 2.71828
Here is how to create them:
↗️
Loading editor...
↶
↷
Those two types have different cases of application (but both are needed). Integers are used for whole numbers, like counting levels or lives, while floating point numbers are used for values that require precision, like weight or speed.
Verify