1
Hatchling0 / 300 XP
0day streak 0stars
Your Python practice
Mock tests Readiness
More
Guest mode · saved on this device.

Project: Temperature converter

Converting Celsius to Fahrenheit: F = C × 9 / 5 + 32.

Real programs get numbers as text from the user, so read them with input() and cast with float().

See it run

typed = "150"   # in the lesson: typed = input("Pounds: ")
pounds = float(typed)
kg = pounds * 0.4536
print(round(kg, 1))

A converter is a small pipeline: text in, number, formula, tidy output. Follow the value along.

Practice project: temperature converter

Exercise 1

The user types 37. Store it as a float in celsius, compute fahrenheit, and print it rounded to 1 decimal (98.6).

Exercise 2

Now go the other way: C = (F − 32) × 5 / 9. The user types 212. Store it as a float in fahrenheit, compute celsius, and print it rounded to 1 decimal (100.0).

Exercise 3

A weather app reads the morning and afternoon temperature in °C (the user types 18 then 26). Read them as floats named morning and afternoon, in that order. - avg_f = the average of the two, converted to °F (71.6) - rise_f = how many °F warmer the afternoon is (14.4) Print both rounded to 1 decimal.

Careful: a difference in temperature scales by 9/5 but does not get +32.

Free lesson: use the editor to practice it.

Practice

Loading Python…
More
Loading exercise content…
Visualizer Watch your code run line by line

Run your code, then choose Play to follow its execution.

Memory · names → values
Variables appear here as Python creates them.
Output & plots

One-line daily quest