2.1摄氏温度转为华氏温度.py

# -*- coding: utf-8 -*-
"""
Created on Sun Apr 22 14:57:48 2018

@author: MyPC
"""
def main():
    ‘‘‘
    摄氏温度转为华氏温度.

    公式:fathrenheiit=(9 / 5) * celsius + 32
    input:celsius
    output:fathrenheiit
    ‘‘‘

    celsius = eval(input("input Celsius:"))
    fahrenheit=(9 / 5) * celsius + 32
    print("%4.2f Celsius is %5.2f fahrenheit"%(celsius,fahrenheit))

if __name__ == "__main__":
    main()

原文地址:https://www.cnblogs.com/Wang-Y/p/8908292.html

时间: 2024-08-30 17:40:32

2.1摄氏温度转为华氏温度.py的相关文章

7-28 摄氏温度转换华氏温度 (5 分)

温度刻画存在不同体系,摄氏度以1标准大气压下水的结冰点为0度,沸点为100度,将温度进行等分刻画.华氏度以1标准大气压下水的结冰点为32度,沸点为212度,将温度进行等分刻画. 根据华氏和摄氏温度定义,转换公式如下: C = ( F – 32 ) / 1.8 F = C * 1.8 + 32 输入格式: 一个不带小数点的数字,表示设摄氏温度. 输出格式: 一个表示华氏温度的数字.请直接采用print()输出计算结果,不需要对输出格式做处理. 输入样例: 36 输出样例: 96.8 F = flo

Python日常更新,get新知识

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #454545; min-height: 14.0px } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #454545 } p.p3 { margin: 0.0px 0.0px 0.0px 0.0px;

Python3 实例(一)

Python Hello World 实例 以下实例为学习Python的第一个实例,即如何输出"Hello World!": 实例 -- coding: UTF-8 -- Filename : helloworld.py author by : www.runoob.com 该实例输出 Hello World! print('Hello World!')执行以上代码输出结果为: Hello World!Python 数字求和 以下实例为通过用户输入两个数字,并计算两个数字之和: 实例(

条件语句,while循环语句:完整的温度转换程序

while True: a = input('1:摄氏转华氏\n2: 华氏转摄氏\n3: 退出\n') if a == '1': celsius = float(input('输入摄氏温度:')) fahrenheit = (celsius*9/5)+32 print('{:.2f}摄氏温度转为华氏温度为{:.2f}\n'.format(celsius,fahrenheit)) elif a == '2': fahrenheit = float(input('请输入华氏温度:')) celsiu

完整的温度转换程序

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

解数据类型与数学运算:求和、温度转换

c = input('请输入摄氏温度:') f = float(c)*9/5+32 print('{}摄氏温度转为华氏温度是{}'.format(c,f)) 原文地址:https://www.cnblogs.com/liangzhijie/p/8946962.html

python基础:条件循环字符串

while True: a = int(input('摄氏度转换为华氏温度请按1\n华氏温度转化为摄氏温度请按2\n')) if a == 1: celsius = float(input('输入摄氏温度:')) fahreaheit = (celsius + 1.8) + 32 # f = c+9/5+32 print('{:.2f}摄氏温度转为华氏温度为{:.2f}'.format(celsius, fahreaheit)) elif a == 2: celsius1 = float(inp

1、完整温度转换,2、数字游戏,3、身份证号解析,4、字符串,5、for循环产生网址

while True: a=int(input('摄氏温度转华氏温度请按1\n华氏温度转摄氏温度请按2:\n')) if a == 1: celsius = float(input('输入摄氏温度:')) fahrenheit = (celsius * 1.8)+32 print('{:.2f}摄氏温度转为华氏温度为{:.2f}'.format(celsius,fahrenheit)) elif a == 2: fahrenheit = float(input('输入华氏温度:')) celsi

简单的应用

习题一:温度转氏程序 插入代码为: while True: a =int(input('摄氏转华氏请按1:\n华氏转摄氏请按2:\n')) if a==1: #用户输入摄氏温度 celsius = float(input('输入摄氏温度:')) #计算华氏温度 fahrenheit=(celsius *1.8)+32 #f=c*9/5+32 #向用户输出华氏温度 print('{:.2f}摄氏温度转为华氏温度为{:.2f}'.format(celsius,fahrenheit)) elif a