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. Linux selinux 规则导致audit拒绝

    Linux selinux 规则导致audit拒绝 转载注明来源: 本文链接 来自osnosn的博客,写于 2019-09-26. 查看 audit2why -d audit2allow 这两个命令. ...

  2. localStorage和sessionStorage的共同点和区别

    共同点: 1.localStorage和sessionStorage都是用来存储客户端临时信息的对象. 2.他们均只能存储字符串类型的对象. 3.不同浏览器无法共享localStorage或sessi ...

  3. C++双指针滑动和利用Vector实现无重复字符的最长子串—力扣算法

    题目: 力扣原题链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 给定一个字符串, ...

  4. vue中Enter触发登录事件和javascript中Enter触发点击事件

    created(){ window.addEventListener('keydown', this.handleKeyDown, true)//开启监听键盘按下事件 } 在methods中当keyC ...

  5. Cocos Creator | 炮弹发射效果模拟

    一.预览效果 ​ 二.设置物理世界属性: 1.打开物理系统: cc.director.getPhysicsManager().enabled = true; 2. 配置重力加速度: cc.direct ...

  6. 简约清新立体商务年终工作总结汇报动态PPT模板

    模版来源:http://ppt.dede58.com/gongzuohuibao/26682.html

  7. bayaim_Centos7.6_mysql源码5.7-multi_20190424.txt

    用户名/密码mysql/mysql 一.安装mysql: 位置位于 /data/mysql 如果遇到依赖,无法删除,使用 rpm -e --nodeps <包的名字> 不检查依赖,直接删除 ...

  8. 搭建Harbor

    搭建Harbor 一.安装准备 二.安装docker-ce 三.安装docker-compose 四.安装harbor 5.1下载安装程序 5.2配置harbor.yml 5.3运行install.s ...

  9. JavaScript-----9.函数

    1.函数的使用 1.1 声明函数和调用函数 //1.声明函数 //function 函数名() { // //函数体 //} function sayHi() { console.log('hi~') ...

  10. IDEA中写MyBatis的xml配置文件编译报错的坑

    IDEA中写MyBatis的xml配置文件编译报错的坑 说明:用IDEA编译工具在项目中使用Mybatis框架,编写mybatis-config.xml和Mapper.xml配置文件时,编译项目出现错 ...