Fahrenheit to Celsius Converter

Fahrenheit-CelsiusDegree Fahrenheit (°F) and Degree Celsius (°C) are the main two units to measure temperature.

The Fahrenheit scale is used mainly in the USA whereas other countries tend to use the Celsius scale.

It is possible to convert a temperature from Celsius degrees to Fahrenheit and vice-versa using the following conversion formulas:
fahrenheit_to_celsius_formulas

Your Challenge


Write a Python script to:

  • Ask the end-user whether they want to convert from Fahrenheit to Celsius or from Celsius to Fahrenheit,
  • Ask the user to enter a temperature in the correct unit,
  • Apply the conversion formula and display the temperature in the new unit.

Testing


You can now use your code to complete the following test plan to test your code:

Celsius degrees to Fahrenheit conversions:

Test # Input Values (°C) Expected Output (°F) Actual Output
#1 20 68
#2 -10 14
#3 0 32

Fahrenheit to Celsius degrees conversions:

Test # Input Values (°F) Expected Output (°C) Actual Output
#1 68 20
#2 14 -10
#3 32 0

Challenge #2


On the temperature scale, the 0°C (=32°F is called Freezing Point which is when water starts freezing and becomes ice. At 100°C (=212°F) water starts to boil. This is called Boiling Point.

Adapt your script to write a message to the end user as follows:

  • You are above boiling point for all temperatures above 100°C
  • You have reached boiling point if the temperature is exactly 100°C
  • You are between freezing point and boiling point for all temperatures between 0°C and 100°C
  • You have reached freezing point if the temperature is exactly 0°C
  • You are below freezing point for all temperatures below 0°C
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.8 / 5. Vote count: 11

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: