我正在尝试创建一个程序来帮助我确定我的最终成绩,但是当平均分低于0.8时,则不会打印6/5。
sum1 = 0
input_string = input("Enter decimal grade separated by commas for Maths ")
list = input_string.split(",")
for num in list:
sum1 += float(num)
print("Average=", sum1/len(list))
average1= (sum1/len(list))/10
if average1 >= 0.8:
print('7');
elif average1 >=0.68:
print('6');
elif average1 >= 0.55:
print('5');
else:
print('not found')
预期输出为0.69,0.69为
Average= 0.69
6
实际输出为0.69,0.69是
Average= 0.69
not found
答案 0 :(得分:3)
在计算(并打印)平均值后,您要除以10。因此,当它打印Average= 0.69
时,它会尝试查找过小的0.069
,因此显示not found
。