标签:self turn __init__ 技术 inf code ima png src
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,‘霍哗‘,‘母猪的产后护理‘,0) s2=StudentDoc(119120110,‘嘿嘿‘,‘火葬规划‘,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())
标签:self turn __init__ 技术 inf code ima png src
原文地址:https://www.cnblogs.com/lyh18/p/14833815.html