目录
1、温度的转化编辑
2、计算圆柱体的体积
3、对整数的各个数字求和
4、计算年数和天数
5、计算能量
6、风寒温度
7、计算跑到长度
8、分割数字
9、三角形面积
10、正六边形面积
12、金融应用
13、金融投资
14、三角形求角
15、正多边形面积
16、反向数字
17、综合
18、工资表
c = int(input("Enter a degree in celsius:"))
print("%s celsius is %s Fahrnheit"%(c,((9/5)*c + 32)))
r, l = map(float, input("enter r and lenth:").split())
print("底面积 %s"%(r*r*3.14))
print("体积 %s"%(r*r*3.14*l))
a = int(input("enter a number between 0 and 1000:"))
print("the sum of digits is %s"%(a%10+a//100+a//10%10))
a = int(input("enter the number of minuters:"))
print("%s minuters is approximately %s years and %s days"%(a,(a//525600),(a%525600//1440)))
a = float(input("enter the water kilograms:"))
b = float(input("enter kaishi wendu:"))
c = float(input("enter jiesu wendu:"))
print("the energy need is %s"%(a*(c-b)*4184))
b=float(input("输入-58到41华氏度之间的温度"))
v=float(input("输入每小时风速大于2里的数值"))
t=35.74+0.6215*b-35.75*v**0.16+0.4275*v**0.16*b
print("风寒温度:%lf"%t)
v, a = map(float, input("enter speed and accetion:").split())
print("the changdu shi %s"%((v*v)/(2*a)))
a = int(input("enter an integer:"))
print(a%10)
print(a//10%10)
print(a//100%10)
print(a//1000)
import math
x1,y1,x2,y2,x3,y3 = map(float,input("enter three points:").split)
x1,y1,x2,y2,x3,y3 = eval(input("enter three points:"))
s1 =math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
s2 =math.sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))
s3 =math.sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3))
s=(s1+s2+s3)/2
print("area %s"%(math.sqrt(s*(s-s1)*(s-s2)*(s-s3))))
import math
a = float(input("enter the side:"))
print("the area is %s"%(((3*math.sqrt(3))/2)*a*a))
a = float(input("enter money:"))
a1=a*(1+0.05/12)
a2=(a+a1)*(1+0.05/12)
a3=(a+a2)*(1+0.05/12)
a4=(a+a3)*(1+0.05/12)
a5=(a+a4)*(1+0.05/12)
a6=(a+a5)*(1+0.05/12)
print("after money%s"%(a6))
amount = eval(input("Enter investment amount:"))
rate = eval(input("Enter annual interest rate:"))
years = eval(input("Enter number of years:"))
accumulateAmount = amount * (1 + rate / 100 / 12)**(years * 12)
print("Accumulated value is {:.2f}".format(accumulateAmount))
import math
a = float(input())
b = float(input())
c = float(input())
if(a+b>c and a+c>b and b+c>a):
A = math.degrees(math.acos((a*a-b*b-c*c)/(-2*b*c)))
B = math.degrees(math.acos((b*b-a*a-c*c)/(-2*a*c)))
C = math.degrees(math.acos((c*c-a*a-b*b)/(-2*a*b)))
print("角A的度数为",A)
print("角B的度数为",B)
print("角C的度数为",C)
else:print("三边无法构成三角形")
s=float(input("请输入正多边形的边长:"))
n=int(input("请你输入边数:"))
import math
area=n*s*s/(4*math.tan(math.pi/n))
print("面积:%lf"%area)
x = eval(input("请输入一个四位数字:"))
y = str(x)
print(y[::-1])
total = float(input("请输入金额:"))
total = int(total * 100)
a = total // 100
total %= 100
b = total // 25
total %= 25
c = total // 10
total %= 10
d = total // 5
total %= 5
e = total
print("美元的个数有%d个,二角五分的硬币有%d个,一角硬币有%d个,\五分硬币有%d个以及%d个美分"%(a, b, c, d, e))
a = str(input("Enter employee's name :"))
b = float(input("Enter number of hours worked in a week:"))
c = float(input("Enter hourly pay rate:"))
d = float(input("Enter federal tax withholding rate:"))
e = float(input("Enter state tax wi thholding rate:"))
f = c * 10
g = d * 100
h = f * 0.2
i = f * 0.09
j = e * 100
k = h + i
sum = f - k
print("\nEmployee Name: %s" %a )
print("Hours Worked: %.1f" %b )
print("Pay Rate: $%.2f" %c)
print("Gross Pay: $%.1f" %f )
print("Deductions:")
print(" Federal Wi thholding (%.1f%%):$%.2f" % (g,h))
print(" State Wi thholding (%.1f%%): $%.2f" % (j,i))
print(" Total Deduction:$%.2f"%k)
print("Net Pay: $%.2f"%sum)