a=[]
b=[]
def sum_file(l):
return sum(float(l)) / len(l)
c=raw_input('aaa:')
for i in c.split():
if int(i) % 2 == 0:
a.append(int(i))
else:
b.append(int(i))
print "Even the average:",sum_file(a)
print "Average of the odd-numbered:",sum_file(b)
输入 : 1 2 3 4 5 6 7 8 9 0
输出结果
Even the average:"4
Average of the odd-numbered:5
温馨提示:答案为网友推荐,仅供参考