实验5

class StudentDoc:
def __init__(self,student_number,name,major,score):
self._student_number=student_number
self._name=name
self._major=major
self._score=score
def info(self):
print(f'{self._student_number},{self._name},{self._major},{self._score}')
def get_score(self):
return self._score
def change_score(self,score1):
self._score=score1
print(f'{self._score}')

 

a1=StudentDoc('202013170025','Wyh','python','90')

a1.info()
a1.get_score()
a1.change_score(89)
a1.info()

实验5

import student

u1=student.StudentDoc('202013170027','Szf','python','88')
u2=student.StudentDoc('202013170040','Dj','python','91')

u1.info()
u1.change_score(87)
u1.get_score()
u1.info()


u2.info()
u2.change_score(85)
u2.get_score()
u2.info()

实验5

上一篇:【FFMPEG】命令使用


下一篇:Python 的__del__()方法 ---内存回收,对象销毁 || 与__init__方法对比