Python Loves Numbers
The problem...
You've worked with text. You know how to store it, transform it, print it.
But most real programs don't just deal with text.
They count things. Calculate things. Measure things.
For that, you need numbers.
The idea!
Python handles numbers natively. No setup. No imports. No extra steps.
You write a number — Python understands it.
Making it real
Numbers in Python come in two main forms:
int— whole numbers. No decimal point.float— numbers with a decimal point.
age = 25 # int
height = 1.80 # float
Python figures out the type automatically based on what you write.
In practice
score = 100
temperature = 36.6
year = 2025
print(score) # 100
print(temperature) # 36.6
print(year) # 2025
What happens?
- Each variable stores a number
- Python knows the type without you telling it
- print() outputs the value directly
Why this matters?
Numbers aren't just values you store. They're values you can use.
price = 49.99
quantity = 3
total = price * quantity
print(total) # 149.97
One calculation. No manual math. Python does it instantly.
Going further
You can always check what type a number is:
age = 25
height = 1.80
print(type(age)) # <class 'int'>
print(type(height)) # <class 'float'>
Same tool you used with strings. Works everywhere.
What's really happening
When you write 25, Python stores it as an integer.
When you write 1.80, Python stores it as a float.
No quotes. No conversion. Just the number.
Heads up!
25and"25"are not the same — one is a number, one is text1.80and1.8are the same value — Python drops the trailing zero- You can't do math with a string —
"25" + 5throws a TypeError
The mindset shift
Stop thinking: "A number is just a number."
Start thinking: "A number is a value with a type — and Python knows exactly what to do with it."
What you should understand now
- Python has two main number types —
intandfloat - Python assigns the type automatically
- Numbers can be used directly in calculations
"25"is not the same as25