Editor

Temperature Converter

Beginner · Write the code · from Python Variables and Data Types: A Practical Introduction

From the lesson: Python Variables and Data Types: A Practical Introduction

Imagine you're shipping a package. You fill out a label that asks for the weight. You write "heavy" instead of a number. The shipping system crashes - it can't calculate a price from the word "heavy."

Read the lesson

Convert a temperature from Fahrenheit to Celsius.

The formula is: **Celsius = (Fahrenheit - 32) * 5 / 9**

A variable fahrenheit is given with the value 98.6. Calculate the Celsius equivalent and print the result in this exact format:

98.6F = 37.0C
fahrenheit = 98.6
# Calculate celsius using the formula
# Print the result

More Variables and Data Types exercises

All Python exercises · 50 practice problems · Python Fundamentals quiz