python-linux
class tom(object):def __init__(self,name,score):
self.__name = name
self.__score = score
def gerder(self):
if self.__score >= 80:
return 'A+优秀'
ifself.__score >= 60:
return 'B+一般'
return 'C+不及格'
p1 = tom('xiaoming',90)
p2 = tom('xiaohua',60)
p3 = tom('xiaohong',50)
页:
[1]