Module 2 · Python literals · Lesson 3 of 6
Floats
A float — type float — is a number with a decimal point: 3.14, -0.5, 2.0. That dot is the whole difference — 2 is an integer, but 2.0 is a float, even though they're the same value.
Not a bug — computers store floats in binary, so some decimals land a hair off. Every language does this.
For very large or very small numbers, you can use scientific notation with an e: 3e8 means 3 × 10⁸, or 300000000.0 — and notice the result is always a float.
One thing that catches everyone out: floats can be slightly imprecise. Run this and look closely at the third line — it's not a Python bug, it's how all computers store decimals in binary.
For everyday work that tiny error never matters. Just know it's there, and don't be surprised when a float ends in a long tail of digits. Next: text.