In python Write a program TempConverter.py that converts temperature from Celsiu
ID: 3789395 • Letter: I
Question
In python
Write a program TempConverter.py that converts temperature from Celsius to Fahrenheit an 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 CD 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 FahrenheitExplanation / Answer
#converstion of temprature
print('Welcome to Temprature Conversion program')
print('1)convert from Farenhiet to Celcious ')
print('2) convert from Celcious to Farenhiet')
n=input("Please Enter 1or 2")
if n==1:
Farenhiet=input("Please input celcious")
celcious=(5.0/9.0)*(Farenhiet-32)
print('%0.2f degree Farenhiet is equal to %0.2f degree Celcious' %(celcious))
elseif n==2:
celcious=input("Enter the celcious")
Farenhiet=(9.0/5.0)*(celcious+32)
print('%0.2f degree Celcious is equal to %0.2f degree Farenhiet' %(Farenhiet))
else:
print('the Number is not input in correct format')
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.