C = float(input("Enter a degree in Celsius:"))
F = (9/5) * C + 32
print("{0} Celsius is {1} Fahrenheit".format(C,F))

Enter a degree in Celsius:43
43.0 Celsius is 109.4 Fahrenheit

import math
R,H = eval(input("Enter the radius and length of a cylinder: "))
area = R * R * math.pi
volume = area * H
print('The area is {0}'.format("%.4f"%area))
print('The volume is {0}'.format("%.1f"%volume))

Enter the radius and length of a cylinder:5.5,12
The area is 95.0332
The volume is 1140.4

feet = float(input("Enter a value for feet: "))
meters = feet * 0.305
print('{0} feet is {1} meters'.format(feet,meters) )

Enter a value for feet:16.5
16.5 feet is 5.0325 meters

water = float(input("Enter a value for feet: "))
initial = float(input("Enter the initial temperature: "))
final = float(input("Enter the final temperature: "))
energy = water * (final - initial) * 4184
print('The energy needed is {0}'.format(energy))

Enter a value for feet: 55.5
Enter the initial temperature: 3.5
Enter the final temperature: 10.5
The energy needed is 1625484.0

balance,interestrate = eval(input("Enter balance and interest rate (e.g., 3 for 3 %):"))
interest = balance * (interestrate/1200)
print('The interest is {0}'.format("%.5f"%interest))

Enter balance and interest rate (e.g., 3 for 3 %):1000,3.5
The interest is 2.91667

v0,v1,t = eval(input("Enter v0,v1,and t:"))
a=(v1-v0)/t
print('The averager acceletion {0}'.format("%.4f"%a))

Enter v0,v1,and t:5.5,50.9,4.5
The averager acceletion 10.0889

from _pydecimal import Decimal
amount = Decimal(input("Enter the monthly saving amount : "))
amount1 = Decimal(0)
for i in range(6):
amount1 = (amount+amount1) * Decimal(1 +0.00417)
print('After the sixth month,the account value is {0}'.format("%.2f"%amount1))

Enter the monthly saving amount : 100
After the sixth month,the account value is 608.82

number = float(input("Enter a number between 0 and 1000 : "))
ge = int(number % 10)
shi = int(number // 10 % 10)
qian = int(number // 100)
digits = ge + shi + qian
print('The sum of the digits is {0}'.format(digits))

Enter a number between 0 and 1000 : 999
The sum of the digits is 27


Python-1-Day的更多相关文章

  1. Python中的多进程与多线程(一)

    一.背景 最近在Azkaban的测试工作中,需要在测试环境下模拟线上的调度场景进行稳定性测试.故而重操python旧业,通过python编写脚本来构造类似线上的调度场景.在脚本编写过程中,碰到这样一个 ...

  2. Python高手之路【六】python基础之字符串格式化

    Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存.[PEP-3101] This ...

  3. Python 小而美的函数

    python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况   any any(iterable) ...

  4. JavaScript之父Brendan Eich,Clojure 创建者Rich Hickey,Python创建者Van Rossum等编程大牛对程序员的职业建议

    软件开发是现时很火的职业.据美国劳动局发布的一项统计数据显示,从2014年至2024年,美国就业市场对开发人员的需求量将增长17%,而这个增长率比起所有职业的平均需求量高出了7%.很多人年轻人会选择编 ...

  5. 可爱的豆子——使用Beans思想让Python代码更易维护

    title: 可爱的豆子--使用Beans思想让Python代码更易维护 toc: false comments: true date: 2016-06-19 21:43:33 tags: [Pyth ...

  6. 使用Python保存屏幕截图(不使用PIL)

    起因 在极客学院讲授<使用Python编写远程控制程序>的课程中,涉及到查看被控制电脑屏幕截图的功能. 如果使用PIL,这个需求只需要三行代码: from PIL import Image ...

  7. Python编码记录

    字节流和字符串 当使用Python定义一个字符串时,实际会存储一个字节串: "abc"--[97][98][99] python2.x默认会把所有的字符串当做ASCII码来对待,但 ...

  8. Apache执行Python脚本

    由于经常需要到服务器上执行些命令,有些命令懒得敲,就准备写点脚本直接浏览器调用就好了,比如这样: 因为线上有现成的Apache,就直接放它里面了,当然访问安全要设置,我似乎别的随笔里写了安全问题,这里 ...

  9. python开发编译器

    引言 最近刚刚用python写完了一个解析protobuf文件的简单编译器,深感ply实现词法分析和语法分析的简洁方便.乘着余热未过,头脑清醒,记下一点总结和心得,方便各位pythoner参考使用. ...

  10. 关于解决python线上问题的几种有效技术

    工作后好久没上博客园了,虽然不是很忙,但也没学生时代闲了.今天上博客园,发现好多的文章都是年终总结,想想是不是自己也应该总结下,不过现在还没想好,等想好了再写吧.今天写写自己在工作后用到的技术干货,争 ...

随机推荐

  1. 推荐一种非常好的新版DSP库源码移植方式,含V7,V6和V5的IAR以及MDK5的AC5和AC6版本

    说明: 1.新版CMSIS V5.6里面的DSP库比以前的版本人性化了好多. 2.本帖为大家分享一种源码的添加方式,之前一直是用的库方便,不方便查看源码部分. 3.DSP教程可以还看第1版的,在我们的 ...

  2. C语言程序设计100例之(11):求质数

    例11  求质数 问题描述 质数是指除了有1和自身作为约数外,不再有其他约数的数.比如:3.5.7是质数.而9不是质数,因为它还有约数3. 编写程序求给定区间中的所有质数. 输入格式 两个整数a和b, ...

  3. Java基础语法05-面向对象-封装-包-构造器-初始化

    封装 面向对象三大特性:封装.继承.多态 封装的好处 1.调用者:方便使用/简化使用 2.设计者:安全,可控 隐藏对象内部的复杂性,只对外公开简单的接口.便于外界调用,从而提高系统的可扩展性.可维护性 ...

  4. Serverless 实战——使用 Rendertron 搭建 Headless Chrome 渲染解决方案

    为什么需要 Rendertron? 传统的 Web 页面,通常是服务端渲染的,而随着 SPA(Single-Page Application) 尤其是 React.Vue.Angular 为代表的前端 ...

  5. 痞子衡嵌入式:飞思卡尔i.MX RTyyyy系列MCU启动那些事(1)- Boot简介

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是飞思卡尔i.MX RTyyyy系列MCU的BootROM功能简介. 截止目前为止i.MX RTyyyy系列已公布的芯片有三款i.MXRT ...

  6. tf.nn.in_top_k的用法

    tf.nn.in_top_k组要是用于计算预测的结果和实际结果的是否相等,返回一个bool类型的张量,tf.nn.in_top_k(prediction, target, K):prediction就 ...

  7. 系统架构师考试知识点mp3资料免费下载

    场景 系统架构设计师考试,属于全国计算机技术与软件专业技术资格考试(简称计算机软件资格考试)中的一个高级考试. 系统架构设计师考试,考试不设学历与资历条件,不论年龄和专业,考生可根据自己的技术水平,选 ...

  8. node-sass 埋坑记录

    node-sass 埋坑记录 背景 原有项目.环境: node:v8.16.2 npm:v6.4.1 node-sass::v4.8.0 Angular-CLI:v6.x 本机没有安装 Visual ...

  9. 搭建部署Docker

    Docker安装准备: 首先看下服务器是否有旧版本,如果有需要卸载并且安装依赖 yum remove docker docker-client docker-client-latest docker- ...

  10. 在Dynamics CRM中使用Bootstrap

    我是微软Dynamics 365 & Power Platform方面的工程师罗勇,也是2015年7月到2018年6月连续三年Dynamics CRM/Business Solutions方面 ...