class TC:
@staticmethod
def c2f(tc):
tc = float(tc)
tf = (tc * 9/5) + 32
return tf
@staticmethod
def f2c(tf):
tf = float(tf)
tc = (tf - 32) * 5/9
return tc
print("1.摄氏温度到华氏温度.")
print("2.华氏温度到摄氏温度.")
choice = int(input("选择路线:"))
if choice == 1:
tc = float(input("输入摄氏温度:"))
tf = TC.c2f(tc)
print("华氏温度:{0:.2f}".format(tf))
elif choice == 2:
tf = float(input("输入华氏温度:"))
tc = TC.c2f(tf)
print("摄氏温度:{0:.2f}".format(tc))
else:
print("鬼")