Live temperature gauge
20°
Celsius
68°
Fahrenheit
293°
Kelvin
1def celsius_to_fahrenheit(c):
2return (c * 9/5) + 32
20
Write celsius_to_fahrenheit(c) using the formula (c * 9/5) + 32. Functions make formulas reusable and named — a cornerstone of clean code.
Put the conversion in def so you can call it for any number.
You write a function that changes a Celsius value into Fahrenheit using a fixed formula.
Used in weather apps, IoT dashboards, health devices, and global systems that support multiple temperature units.
/ division — use round() for clean output.A weather app receives API data in Celsius but US users expect Fahrenheit. celsius_to_fahrenheit() is called for every temperature card — one function, used a thousand times per page load.