# Flowchart to Python Code – Temperature Converter

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:

#### Your Challenge

Use the following flowchart to write a Temperature Converter in Python. Your script will:

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

#### Python Code

This algorithm is a good example of:

#### Testing

Once your code is done, complete the following tests to check that your code is working as expected:

 Test # Input Values Expected Output Actual Output #1 Option 110°C 50°F #2 Option 10°C 32°F #3 Option 1-5°C 23°F #4 Option 250°F 10°C #5 Option 232°F 0°C #6 Option 223°F -5°C #4 Option x Invalid option!

#### Solution...

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

Did you like this challenge?

Click on a star to rate it!

Average rating 4.7 / 5. Vote count: 13

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

As you found this challenge interesting...

Follow us on social media!

Tagged with: