python 练习1-18

1.

c =int ( input("Ender a degree in celsius"))
f = (9/5) * c + 32
print ("%d celsius is %d fahrenheit"%(c,f))

 2.

a = 3.14 
#r = float(input("输入半径:"))
#h = float(input("输入高:"))
r,h =input("输入半径和高").split(",")
r=int(r)
h=int(h)
s = r * r * a
print ("底面积为%f"%(s))
print ("体积为%f "%(s*h))

3.

a = int (input("从0-1000中输入一个数:"))
b = a % 10
num = a // 10
c = num % 10
num = c // 10
d = num % 10
print("数字之和为:%d"%(b+c+d))

4.

m = int (input ("输入一个分钟数:"))
day = m / 1440
while True:
 	if day>365:
 		year+=1
 		day-=365
 	else:
 		break
print ("%d minutes is approximately %d year and %d days"%(m,day,year))

5.

m =float( input("输入水的重量:"))
a =float( input("输入初始温度:"))
b =float( input("输入目标温度:"))
Q = m * (b - a ) * 4184
print ("所需要的热量为:%f"%(Q))

6.

F =float( input("输入一个-58华氏度到41华氏度的温度:"))
V = float (input("输入风速:"))
a = 35.74 + 0.6215 * F - 35.75*(V**0.16)+0.475*(V**0.16)
print("风寒温度为:%f"%(a))

7.

v,a = input("输入飞机的起飞速度与加速度:").split(",")
v = float(v)
a = float(a)
l = v * v / (2*a)
print ("最短的跑道长度为:%f"%(l))

8.

num =int ( input ("输入一个4位数:"))
a = num % 10
num//=10
b = num % 10
num//=10
c = num % 10
num//=10
d = num % 10
print(a)
print(b)
print(c)
print(d)

9.

import math
a,b,c,d,e,f = input("输入3个坐标:").split(",")
A = float(a-c)
B = float(b-d)
C = float(a-e)
D = float(b-f)
E = float(c-e)
F = float(d-f)
X =math.sqrt((A**2)+(B**2))
Y =math.sqrt((C**2)+(D**2))
Z =math.sqrt((E**2)+(F**2))
s = (X+Y+Z)/2
S = math.sqrt(s*(s-X)*(s-Y)*(s-Z))
print("面积为:%f" %(S))

10.

a=float(input("输入边长:"))
s = 3*(3**0.5)*a*a/2
print("面积为:%.4f"%(s))

12.

a =float( input ("输入每月存款 : "))
num = a *1.00417
i=0
if i<5:
	num+=a
	num*=1.00417
	i+=1
print("6个月后的账户余额:%f"%(num))

13.

a=float(input("投资金额"))
b=float(input("年利率"))
c=float(input("年数"))
s = a *((1+b)**c)
print("未来投资额为:%f"%(s))

14.

import math
a = int (input ("输入第一条边"))
b = int (input ("输入第二条边"))
c = int (input ("输入第三条边"))
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(A)
print(B)
print(C)

15.

import math
n = float(input("输入边数:"))
s = float (input("输入边长:"))
t = math.tan(3.14/n)
S = (n * s *s) /(4 * t)
print ("面积为:%f"%(S))

16.

a = input("输入一个4位数:")
b = a[0:4]
c = b[3]+b[2]+b[1]+b[0]
print(c)

17.

num = float (input("输入金额:"))
num = num*100
a = num//100
num = num %100
b = num//25
num = num %25
c = num // 10
num = num % 10 
d = num // 5 
e = num % 5
print("一共有%d美元,%d个二角五分硬币,%d个一角硬币,%d个五分硬币,%d个一分硬币"%(a,b,c,d,e)) 
 

18.

name = input("输入姓名:")
time = int(input("输入工作时间:"))
rate = float(input("输入每小时报酬:"))
s = float(input ("输入联邦预扣税率:"))
f = float(input("输入州预扣税率:"))
pay = time * rate
tax_s = pay * s
tax_f = pay * f
total = tax_s + tax_f
s = pay - total
print("姓名"+name)
print("工作时间:%d"%(time))
print("每小时报酬:%f"%(rate))
print("总报酬:%f"%(pay)
print("扣除:")
print("		联邦预扣税:%f"%(tax_s))
print("		州预扣税:%f"%(tax_f))
print("		总扣除税: %f"%(total))
print("应得报酬:%f"%(s))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值