Question: Write a program TempConverter.py in python that converts temperature from Celsius to Fahrenheit and from Fahrenheit to Celsius depending on the user input. Display a
Write a program TempConverter.py in python that converts temperature from Celsius to Fahrenheit and from Fahrenheit to Celsius depending on the user input. Display a menu to the user to select an option (1 for C to F and 2 for F to C).
Additional information
a) Use input function to receive user input
b) Use floating point number for Celsius and Fahrenheit
c) Output should display only two decimal values. So, use format specifier %.2f
Welcome to Temperature Conversion Program
1) Convert from Fahrenheit to Celsius
2) Convert from Celsius to Fahrenheit
Enter your choice: 1
Enter temperature: 68.3
Expected Output
You selected Option 1 68.30 degrees Fahrenheit is equal to 20.17 degrees Celsius
Welcome to Temperature Conversion Program
1) Convert from Fahrenheit to Celsius
2) Convert from Celsius to Fahrenheit
Enter your choice: 2
Enter temperature: -12.80
Expected Output
You selected Option 2 -12.80 degrees Celsius is equal to 8.96 degrees Fahrenheit
a) The formula to convert Fahrenheit to Celsius is
celsius=5.0/9.0*(fahrenheit-32)
b) The formula to convert Celsius to Fahrenheit is
fahrenheit=9.0/5.0*celsius+32
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
