class StudentDoc: def __init__(self,studentnumber,name,major,point): self._studentnumber = studentnumber self._name = name self._major = major self._point = point def info(self): print(f'学生学号:{self._studentnumber}') print(f'学生姓名:{self._name}') print(f'学生专业:{self._major}') print(f'Python课程分数:{self._point}')
def change_point(self,newpoint): self._point = newpoint return newpoint
a1 = StudentDoc('123','Bob','python','90') a1.change_point(99) a1.info()
class StudentDoc: def __init__(self,studentnumber,name,major,point): self._studentnumber = studentnumber self._name = name self._major = major self._point = point def info(self): print(f'学生学号:{self._studentnumber}') print(f'学生姓名:{self._name}') print(f'学生专业:{self._major}') print(f'Python课程分数:{self._point}') def change_point(self,newpoint): self._point = newpoint return newpoint def main(): a1 = StudentDoc('123', 'Bob', 'python', '90') a1.change_point(99) a1.info() if __name__ == '__main__': main()