用户选择

a=input('1.摄氏转华氏 2.华氏转摄氏')
if a =='1':
    f=float(input('请输入华氏温度'))
    c=5/9*(f-32)
    print('{}华氏度转为摄氏度是{}'.format(f,c))
else:
    c=input('请输入摄氏温度')
    f=float(c)*9/5+32
    print('{}摄氏温度转为华氏温度是{}'.format(c,f))

猜你喜欢

转载自www.cnblogs.com/mintine/p/8947181.html