将华氏温度转换成摄氏温度,或者相反,华氏摄氏,#-*- charset
文章由Byrx.net分享于2019-03-23 05:03:16
将华氏温度转换成摄氏温度,或者相反,华氏摄氏,#-*- charset
#-*- charset:utf-8 -*-#This program will follow users intention to convert F to C or the contraytypeNo = eval(input("Do you want to convert Fah to Cel or convert Cel to Fah,enter 1 for F to C,enter 2 for C to F:"))if typeNo == 1: data = eval(input("Please enter your data:")) c = (data - 32) * 5 / 9 print(data,"Fahrenheit to Celsius is:",round(c,1)," C")elif typeNo == 2: data = eval(input("Please enter your data:")) f = data * 9 / 5 + 32 print(data,"Celsius to Fahrenheit is:",round(f,1)," F")elif (typeNo != 1) and (typeNo != 2): print("Input error!")
评论关闭