Numbers: int, float, complex in Python
Python has three built-in numeric types: int for whole numbers of any size, float for decimal numbers, and complex for numbers with a real and imaginary part. Ints in Python can grow arbitrarily large without overflowing, unlike the fixed-size integers many other languages use.
Floats, on the other hand, are stored with limited precision — the same binary format nearly every language uses — which occasionally produces results that look slightly "off," like 0.1 + 0.2 not printing as exactly 0.3. That's a property of how decimals are represented in binary, not a Python quirk.
int — whole numbers
Positive or negative, with no fixed size limit — Python grows the number as needed.
float — decimal numbers
Stored using the standard double-precision format most languages share.
Floating-point precision has limits
0.1 + 0.2 does not equal exactly 0.3, because most decimal fractions have no exact binary representation.
complex — real and imaginary parts
Written like 2+3j, used mainly in scientific and engineering calculations.
Mixing int and float promotes to float
5 + 2.5 automatically becomes 7.5, a float — Python never silently loses the decimal part.
print(10 // 3)print(10 / 3)print(0.1 + 0.2)print(2 ** 10)Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in Python yourself — building beats watching.