实验5
Posted dsadsads
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实验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()
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的主要内容,如果未能解决你的问题,请参考以下文章