#!/usr/bin/python # -*- coding:utf-8 -*- # -*- author:DavidHuang # 用户输入摄氏温度 # 接收用户收入 celsius = float(input(‘输入摄氏温度: ‘)) # 计算华氏温度 fahrenheit = (celsius * 1.8) + 32 print(‘%0.1f 摄氏温度转为华氏温度为 %0.1f ‘ %(celsius,fahrenheit)) # 华氏转摄氏 Fahrenheit = float(input(‘输入华氏温度:‘)) # 计算摄氏温度 Celsius = (Fahrenheit-32)*5/9 print(‘%0.1f 华氏温度转为摄氏温度为 %0.1f ‘ %(Fahrenheit,Celsius))
原文:https://www.cnblogs.com/EncodingDavid/p/9581679.html