Degree 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:
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.
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|
Fahrenheit to Celsius degrees conversions:
|Test #||Input Values (°F)||Expected Output (°C)||Actual Output|
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
Solution...The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area