Python 摄氏温度转华氏温度
Python 3 教程
· 2019-02-12 09:43:23
以下实例演示了如何将摄氏温度转华氏温度:
实例
# -*- coding: UTF-8 -*-
# Filename : test.py
# author by : www.codercto.com
# 用户输入摄氏温度
# 接收用户输入
celsius = float(input('输入摄氏温度: '))
# 计算华氏温度
fahrenheit = (celsius * 1.8) + 32
print('%0.1f 摄氏温度转为华氏温度为 %0.1f ' %(celsius,fahrenheit))
执行以上代码输出结果为:
输入摄氏温度: 38 38.0 摄氏温度转为华氏温度为 100.4
以上实例中,摄氏温度转华氏温度的公式为 celsius * 1.8 = fahrenheit - 32。所以得到以下式子:
celsius = (fahrenheit - 32) / 1.8
点击查看所有 Python 3 教程 文章: https://www.codercto.com/courses/l/10.html
Linux Device Drivers
Jonathan Corbet、Alessandro Rubini、Greg Kroah-Hartman / O'Reilly Media / 2005-2-17 / USD 39.95
Device drivers literally drive everything you're interested in--disks, monitors, keyboards, modems--everything outside the computer chip and memory. And writing device drivers is one of the few areas ......一起来看看 《Linux Device Drivers》 这本书的介绍吧!