实验5

 

class StudentDoc:
    def __init__ (self,number,name,major,score):
        self.number=number
        self.name=name
        self.major=major
        self.score=score

    def info(self):
        print(f'{self.number},{self.name},{self.major},{self.score}')

    def get_score(self):
        return self.score

    def change_score(self,change):
        self.score=change

from student import StudentDoc
s1=StudentDoc(110120119,'dvdv','ldz',0)
s2=StudentDoc(119120110,'dvd','ddv',1)

s1.info()
s2.info()

print(f'分数:',s1.get_score())
print(f'分数:',s2.get_score())

s1.change_score(100)
s2.change_score(100)
print(f'分数:',s1.get_score())
print(f'分数:',s2.get_score())

 

 





posted @ 2021-06-11 15:56  陆恩泽  阅读(43)  评论(2)    收藏  举报