第一题
Demo01
a = float(input("当前摄氏温度:" ))
b = (9 / 5) * a + 32
print("当前华氏温度:" +str(b))
第二题
Demo02
r = float(input("请输入圆柱的半径:"))
h = float(input("请输入圆柱的高:"))
pai = 3.14
s = r * r * pai
v = s * h
print("圆柱底面积:" +str(s))
print("圆柱体积:" +str(v))
第三题
Demo03
a = int(input("输入一个0到1000的整数:"))
b = a % 10
c = (a // 10) % 10
d = (a // 100) % 10
e = (a // 1000)
x = b + c + d + e
print("各个数字之和是:" +str(x))
第四题
Demo04
a = int(input("输入一个分钟数:"))
year = a // (365*24*60)
fen1 = a % (365*24*60)
day = fen1 // (24*60)
print("%s 分钟数对应的 %s 年数和 %s天数"%(a,year,day))
第五题
Demo05
M = float(input("多少千克的水:"))
first = float(input("初始温度:"))
final = float(input("最终温度:"))
Q =M * (final - first) * 4184
print("水从初始温度加热到最终温度所需能量:" +str(Q))
第六题
Demo06
t = float(input("请输入一个-58度到41度之间的温度:"))
v = float(input("请输入一个大于等于2里的风俗:"))
Twc = 35.74 + 0.6215*t - 35.75 * (v**0.16) + 0.4275*t *(v**0.16)
print("当前风寒温度:" +str(Twc))
第七题
Demo07
第八题
Demo08
a = int(input("请输入一个四位整数:"))
b = a %10
c = a // 10 %10
d = a // 100 %10
e = a // 1000
print(b)
print(c)
print(d)
print(e)
第九题
Demo09
x1,y1,x2,y2,x3,y3 = eval(input ("请输入三角形三个顶点坐标:"))
side1 = ((x2-x1)**2 +(y2-y1)**2)**0.5
side2 = ((x3-x1)**2 +(y3-y1)**2)**0.5
side3 = ((x2-x3)**2 +(y2-y3)**2)**0.5
s =(side1 + side2 + side3)/2
area = (s*(s-side1)*(s-side2)*(s-side3))**0.5
print("三角形面积:" +str(area))
第十题
Demo10
l = float(input("输入正六边形边长:"))
s = 3 *(3**0.5) / 2 * (l**2)
print("正六边形面积:" +str(s))
第十一题
Demo11 略过
第十二题
Demo12
a = float(input("请输入存款数:"))
b = a * (1+0.00417)
c = (a + b)* (1+0.00417)
d = (a + c)* (1+0.00417)
e = (a + d)* (1+0.00417)
f = (a + e)* (1+0.00417)
g = (a + f)* (1+0.00417)
print("六个月后账户总额:" +str(g))
第十三题
Demo13
a = float(input("请输入金额:"))
b = float(input("请输入年利率:"))
c = float(input("请输入年数"))
d = a * ((1+b)**c)
print("未来投资额:" +str(d))
第十四题
Demo14
a =float(input("三角形a的边:"))
b =float(input("三角形b的边:"))
c =float(input("三角形c的边:"))
A =math.acos((a*a - b*b - c*c )/ (-2 *b *c))
B =math.acos((b*b - a*a - c*c )/ (-2 *a *c))
C =math.acos((c*c - b*b - a*a )/ (-2 *a *b))
print("%s A的角 %s B的角 %s C的角:" %(A,B,C))
第十五题
Demo15
第十六题
Demo16
第十七题
Demo17
a = float(input("输入一个十进制带小数点的数字:"))
b = a * 100
dollar =b // 100
some1 = b % 100
twof = some1 // 25
some2 = some1 % 25
One = some2 // 10
some3 = some2 % 10
five = some3 // 5
one = some3 % 5
print("一美元%s,两角五美分%s,一角美元%s,五美分%s,一美分的数量%s:" %(dollar,twof,One,five,one))
第十八题
Demo18
name = input("请输入姓名:")
hour = float(input("一周工作时间:"))
pay = float(input("每小时薪水:"))
tax1 = float(input("联邦预扣税率:"))
tax2 = float(input("州预扣税率:"))
money = hour * pay
taxl = tax1 * money
taxz = tax2 * money
total = taxl + taxz
restMoney = money - total
print("姓名:%s " %(name))
print("工作时间:%s " %(hour))
print("薪水:%s " %(pay))
print("联邦预扣税率:%s " %(tax1))
print("州预扣税率:%s " %(tax2))
print("总扣税:%s " %(total))
print("到手:%s " %(restMoney))
|