AcWing 661. 平均数3 - Python3
原题链接
中等
作者:
KYCygni
,
2021-03-12 07:02:08
,
所有人可见
,
阅读 320
Python3 代码
n = input().split()
w = [0.2, 0.3, 0.4, 0.1]
avg = 0
for i in range (0, len(n)):
avg += eval(n[i]) * w[i]
print ("Media:", f'{avg:.1f}')
if avg > 7.0:
print ("Aluno aprovado.")
elif avg < 5.0:
print ("Aluno reprovado.")
else:
print ("Aluno em exame.")
y = float(input())
print ("Nota do exame:", y)
z = (avg + y)/2
if z >= 5.0:
print ("Aluno aprovado.")
else:
print ("Aluno reprovado.")
print ("Media final:", f'{z:.1f}')