Answer to Question #225977 in Python for GANESH

Question #225977

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.

Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.


1
Expert's answer
2021-08-13T16:12:38-0400
temperature = input()
scale=temperature[-1]
temperature=temperature[0:len(temperature)-1]
temperature=float(temperature)
if scale.upper()=='C':
    F=(9/5)*temperature + 32
    K=temperature+273.15
    print(f"{round(temperature,2)}C")
    print(f"{round(K,2)}K")
    print(f"{round(F,2)}F")
elif scale.upper()=='F':
    C=(temperature-32)*(5/9)
    K=C+273
    print(f"{round(temperature,2)}F")
    print(f"{round(C,2)}C")
    print(f"{round(K,2)}K")
elif scale.upper()=='K':
    C=temperature-273
    F=(9/5)*int(C) + 32
    print(f"{round(temperature,2)}K")
    print(f"{round(C,2)}C")
    print(f"{round(F,2)}F")
else: 
    print("Wrong temperature format")





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