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. 文字转语音?我只用十行Python代码就搞定了!

    详细使用教程 1.没安装Python的小伙伴需要先安装一下 2.win+r输入cmd打开命令行,输入:pip install baidu-aip,如下安装百度AI的模块. 3.新建文本文档,copy如 ...

  2. tf读取图片,matplotlib可视化

    代码: """ 使用tf读取图片 """ import tensorflow as tf import matplotlib.pyplot ...

  3. Eclipse与IDEA配置tomcat

    在eclipse中配置tomcat 打开servers窗口点击新建服务器 选择apache下对应版本,填写服务器名(自定义) 点击browse指定tomcat解压路径,点击finish 在server ...

  4. go路由httprouter中的压缩字典树算法图解及c++实现

    目录 go路由httprouter中的压缩字典树算法图解及c++实现 前言 httprouter简介 压缩字典树 概念 插入操作 查询操作 c+++实现 go路由httprouter中的压缩字典树算法 ...

  5. vue如何debugger源码

    在我们阅读vue源码时,一般引用vue的版本都是打包编译后的版本,无法debugger源码,要debugger源码,就需要给代码添加sourcemap,他存储源码与编译后代码的一种对应关系,详细内容可 ...

  6. Effect:Mobile ocd

    Satisfy the following two Keep your phone at all times Check your phone even if there's no news Alwa ...

  7. 华为网络设备修改console密码

    user-interface con 0set authentication password cipher 新密码 有的版本为 <FW> system-view[FW] user-int ...

  8. JS获取url请求参数

    JS获取url请求参数,代码如下: // 获取url请求参数 function getQueryParams() { var query = location.search.substring(1) ...

  9. Web安全测试学习笔记-DVWA-CSRF

    CSRF(Cross-site request forgery)跨站请求伪造,CSRF的原理简单来说就是攻击者以用户的名义对服务器发起请求,从而达到攻击目的.与XSS不同之处在于,XSS是盗取用户co ...

  10. QAnet Encoder

    #!/usr/bin/python3# -*- coding: utf-8 -*-'''date: 2019/8/19mail: cally.maxiong@gmail.comblog: http:/ ...