Your Second Mini Project — Make the Math Work
The problem...
You've learned how numbers work. You've done arithmetic. You've used the math module.
But you haven't built anything with it yet.
It's time to change that.
The idea!
You're going to build a temperature converter.
The user types a temperature in Celsius. Your program converts it to Fahrenheit.
Simple. Useful. Real.
What you'll use
input()— to get the temperature from the userfloat()— because temperatures can have decimals- arithmetic — to do the conversion
- f-strings — to display the result cleanly
The formula
Fahrenheit = (Celsius × 9/5) + 32
celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print(f"{celsius}°C is {fahrenheit:.1f}°F")
If the user types 100:
Output → 100.0°C is 212.0°F
The full program
celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print(f"{celsius}°C is {fahrenheit:.1f}°F")
Three lines. A real converter.
Going further
Add the reverse — Fahrenheit to Celsius:
fahrenheit = float(input("Enter temperature in Fahrenheit: "))
celsius = (fahrenheit - 32) * 5/9
print(f"{fahrenheit}°F is {celsius:.1f}°C")
If the user types 212:
Output → 212.0°F is 100.0°C
What's really happening
You didn't learn anything new in this article.
You took input, applied a formula, and formatted the output.
That's all programming is — taking what you know and combining it.
Heads up!
- Use
float()notint()— temperatures can be decimal :.1fin the f-string rounds the output to 1 decimal place- If the user types text instead of a number, the program will crash — that's normal for now
The mindset shift
Stop thinking: "I need to learn more before I can build something."
Start thinking: "What problem can I solve with what I already know?"
What you should understand now
- Real programs apply formulas to user input
- float() handles decimal input
- f-strings format numbers cleanly
- Three lines can be a real, useful program