Hello everyone,
I'm a beginner in programming languages and in Python. I came across this error and I don't khow if it is a logical error or a design error. The problem is with class_average
a = {1:[1, 2, 3],
2:[3,4,5],
3:[6,7,8]
}
b = {1:[3,7,4],
2:[8,2,9],
3:[3,6,3]
}
c = {1:[4,7,1],
2:[5,5,9],
3:[2,3,7]
}
p=[a,b,c]
def average(p):
return sum(p)/len(p)
def get_average(d):
return average(p[1]) + average(p[2]) + average(p[3])
def class_average(p):
for item in p:
retun average(get_average(item))
or
def class_average(p):
for item in p:
return sum(get_average(item))