实验5
作者:互联网
class StudentDoc: def_ init_ (self,n,a,m,s): self. n=n self._ aa self._ mm self._ s=s def set(self,s): self._ S=s def date(self): print(f'#%: fself._ a),#5: (self._ ),+x: fself._ m),Æá: fself._ s)') def score(self): print(f(self._ s)) def main(): s1-StudentDoc(1,'t','T' ,99 s2=StudentDoc(2,'g','G' ,11) print(s1. date())
from student import StudentDoc s1=StudentDoc(num=1,name='a',major='A',score='0') s2=StudentDoc(num=2,name='b',major='B',score='0') print(s1.date()) s1.set(50) print(s1.date()) print(s2.score())
标签:self,._,实验,StudentDoc,print,s1,def 来源: https://www.cnblogs.com/aihe1808/p/14828299.html