Editor

Celsius to Fahrenheit

#201 · Python Basics · Beginner · 25 XP · about 3 min

A weather app stores temperatures in degrees Celsius but has to show them in Fahrenheit too. Write to_fahrenheit(celsius) that converts a temperature with the formula F = C * 9 / 5 + 32 and returns the result rounded to one decimal place with round(value, 1).

Examples

to_fahrenheit(100)   # returns 212.0
to_fahrenheit(-40)   # returns -40.0
to_fahrenheit(36.6)  # returns 97.9

36.6 * 9 / 5 + 32 is 97.88, which rounds to 97.9.

Note

celsius can be a whole number or a decimal, and it can be negative.

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.