line = "After fresh rain in mountains bare "
print(line.title())
a = float(input("输入三角形第一条直角边长:"))
b = float(input("输入三角形第二条直角边长:"))
area=(a*b)/2
print("直角三角形的面积为:{:.1f}".format(area))
num = eval(input("输入数字:"))
print("对应的二进制数:{0:b}\n八进制数:{0:o}\n十六进制数:{0:X}".format(num))#注意0
import turtle
turtle.color('black','yellow')
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
def judge_year(year):
if (year%4==0 and year%100!=0) or year%400==0:
print(year,"年是闰年")
else:
print(year,"年不是闰年")#有空格
year = eval(input("请输入年份:"))
judge_year(year)
fi = open("score.csv","r")
fo = open("avg-score.txt","w")
ls = []
x = []
sum = 0
for row in fi:
ls.append(row.strip("\n").split(","))
for line in ls[1:]:
for i in line[1:]:
sum+=int(i)
avg=sum/3
x.append(avg)
sum=0
fo.write("语文:{:.2f}\n数学:{:.2f}\n英语:{:.2f}\n物理:{:.2f}\n科学:{:.2f}\n".format(x[0],x[1],x[2],x[3],x[4]))
fi.close()
fo.close()