Python-1-Day

系统 1495 0

Python-1-Day_第1张图片

 

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
                
Python-1-Day_第2张图片

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
                
Python-1-Day_第3张图片

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
                
Python-1-Day_第4张图片

 

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
                
Python-1-Day_第5张图片

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
                
                
                  Python-1-Day_第6张图片
                
                

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
                
Python-1-Day_第7张图片

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
                
                
              

更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论