celsius=float(input('enter a degree in celsius:'))
fahreheit=float(9/5)*celsius+32
print(celsius,'celsius is ',fahreheit,'fahreheit')
2 计算圆柱体的体积
radius,length = map(float,input('enter the radius and length of a cylinder:').split(','))
area=radius*radius*3.14
volume=area*length
print('the area is',area)
print('the vllume',volume)
3 将英尺数转换位米数
yingchishu=float(input('enter a value for feet:'))
mishu=yingchishu *0.305
print(yingchishu,'feet is ',mishu ,'meters')
4 (科学:计算能量)
wk=float(input('enter the amout of water in kilograms: '))
inittem=float(input('enter the initail temperature:'))
fintem=float(input('enter the final temperature:'))
q=wk*(fintem-inittem)*4184
print('the energy neede is ',q)
5(金融应用程序:计算利息)
money,rate= map (float,input('enter balance and interest rate(e.g. 3 for 3%)').split(','))
interest=money*(rate/1200)
print('the interest %.5f'%(interest))
6(物理方面:加速度)
v0,v1,t = map (float,input('enter v0,v1,and t :').split(','))
a=float((v1-v0)/t)
print('the average accelerration is %.4f'%(a))
7 (金融应用程序:复利值)
amount=float(input('Enter the monthly saving amount:'))
rate1=float(0.05/12 )
rate=float('%.5f'%(rate1))
moumouth=0
print(rate)
for i in range(6):
moumouth =(moumouth+amount)*(1+rate)
print('After the sixth month,the account valueis: ','%.2f'%moumouth)
8 对一个整数中各个数字求和
Num=float(input('Enter a number between 0 and 1000:'))
bai=int(Num/100)
shi=int((Num-bai *100)/10)
ge=int(Num%10)
print('The sum of the digits is:', bai+shi+ge)
9 对一个数学表达式结果取整
a=float(input('请输入一个数字'))
b=float(input('请输入一个数字'))
if( b!=0 and a%b==0):
print(a/b)
else:
print('%.0f'%(a/b))
10判断一个数是奇数还是偶数
a=int(input('请输入一个数字'))
if a%2==0:
print('该数字是偶数')
else:
print('该数字是奇数')