day01homework

no.1
celsius=float(input('Enter a degree in celsius:'))
fahrenheit=(9/5)*celsius+32
print('%f Celsius is %.2f Fahrenheit ' %(celsius,fahrenheit) )

no.2
import math
radius=float(input('Enter the radius:'))
length=float(input('Enter the length:'))
area=radius*radius*math.pi
volume=area*length
print('The area is %.4f'%area)
print('The volume is %.1f'%volume)
no.3
feet=float(input('Enter a value for feet:'))
meters=feet*0.305
print('%f feet is %f meters'%(feet,meters))
no.4
amount=float(input('Enter the amount of water in kilograms:'))
initial=float(input('Enter the initial temperature:'))
final=float(input('Enter the final temperature:'))
q=amount*(final-initial)*4184
print('The energy needed is %f'%q)
no.5
blance=float(input('Enter balance:'))
rate=float(input('Enter interest rate:'))
interest=blance*(rate/1200)
print('The interest is %.5f'%interest)
no.6
v0,v1,t=map(float,input('Enter v0,v1,and t:').split())
a=(v1-v0)/t
print('The average acceleration is %.4f'%a)
no.7
amount=float(input('Enter the monthly saving amount:'))
s=0
for  i in range(6):
    s=(s+amount)*(1+0.00417)
print('After the sixth month,the account value is %.2f'%s)
no.8
num=float(input('Enter a number between 0 and 1000:'))
a=num//100
b=num//10%10
c=num%10
s=a+b+c
print('The sum of the digits is %i'%s)
no.9
print(25/4)
s=int(25/4)
print(s)
no.10
num=int(input('Enter a number :'))
if num%2==0:
    print('偶数') 
else:
    print('奇数')
no.11
num=int(input('Enter a number :'))
a=num//60
b=num-a*60
print('%i分%i秒'%(a,b))
no.12
day=int(input('今天是星期几:'))
s=(day+10)%7
print('10天以后是星期%d' %s)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值