Challenge: Temperature Conversion
Test yourself and implement what you have learned so far in this chapter.
We'll cover the following
Problem statement
You are given a variable, fahrenheit
, which stores a temperature in degrees Fahrenheit. You have to create a variable, celsius
, which converts the temperature stored in fahrenheit
to degrees Celsius.
To convert temperature from degrees Fahrenheit to degrees Celsius, you first need to subtract 32 from the temperature, then multiply it by 5, followed by a division by 9.
Input
The input is the variable fahrenheit
.
fahrenheit
has already been declared for you.
Output
The output will be the value assigned to celsius
.
Sample input
50.0
Sample output
10.0
Test yourself
Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck!
Create a free account to access the full course.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy