Answer to Question #324861 in Python for dv13

Question #324861

Write a python program that implements a “Fahrenheit to

Celsius converter”. Upon program execution, the user is prompted to enter a

temperature in Fahrenheit and the program will output the corresponding temperature in

Celsius. The formula to convert a temperature given in Fahrenheit (F) to a

temperature in Celsius (C) is C = (F - 32)/1.8. Your solution should make use of floating

point (non-integer) values to obtain full marks. If you are not able to work with floating

point numbers, then provide an implementation with integer values (in this case, you can

use the following formula: C = (F - 32)/2. A solution that works only with integer values

will result in a decrease of marks but part marks will be provided.


1
Expert's answer
2022-04-06T10:14:32-0400

while True:

  try:

    F_temp=float(input('Enter a temperature in Fahrenheit: '))

    break

   

  except:

    print('You can only enter a numbers.')


C_temp = (F_temp - 32)/1.8


print('Temperature in Celsius is: {:.2f}'.format(C_temp))


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS