大佬,打印出平均分,最高,最低分的语句怎么写呀?如图!
class students:
def __init__(self,name,hao,math,english,computer):
self.name=name
self.hao=hao
self.math=math
self.english=english
self.computer=computer
def score(self):
score=self.math +self.english +self.computer
return score
def math(self):
return self.math
def english(self):
return self.english
def computer(self):
return self.computer
class subject:
def __init__(self,*students):
self.list1=[i.math() for i in students]
self.list2=[i.english() for i in students]
self.list3=[i.conputer() for i in students]
def ave(self):
return "数学平均分{}英语平均分{}计算机平均分{}".format(sum(self.list1)/len(self.list1),sum(self.list2)/len(self.list2),sum(self.list3)/len(self.list3))
def max(self):
return"数学最高分{}英语最高分{}计算机最高分{}".format(max(self.list1),max(self.list2),max(self.list3))
def min(self):
return"数学最低分{}英语最低分{}计算机最低分{}".format(min(self.list1),min(self.list2),min(self.list3))
a=students('zhang',2000,91,96,93)
b=students('ming',2001,93,82,91)
c=students('chen',2002,86,84,93)
print("总分为:",a.score(),b.score(),c.score())
print