Start free

Novice · Arithmetic · 23 of 264

Celsius to Fahrenheit

Read a temperature in degrees Celsius and convert it to Fahrenheit: F = C * 9 / 5 + 32. Print it with one decimal.

Input: a whole number, degrees Celsius. Output: degrees Fahrenheit, one decimal, e.g. 98.6

Examples

Input
37
Output
98.6
Input
0
Output
32.0
Input
100
Output
212.0
Input
-40
Output
-40.0

One more test checks other inputs when you press Check.

Stuck? The idea behind arithmetic

input() always gives text: turn it into a whole number with int() or a decimal with float() before doing sums.

+ - * / work as in maths; / always gives a decimal. // divides and drops the remainder, % gives the remainder, ** raises to a power.

a = int(input())
b = int(input())
print(a + b)
print(a // b, a % b)

Watch for: "5" + "3" is "53", not 8: if a sum joins numbers together, an int() is missing.

All the arithmetic exercises
Your code
Opening the code editor…
Python 3.14 in your browser
Output
Run shows what your program prints. Check tests it on every example and the hidden tests.

More arithmetic exercises