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)
day01homework
最新推荐文章于 2023-07-05 08:59:15 发布