'''student.py'''
class StudentDoc:
'''学生档案管理'''
def __init__(self,students_number,studens_name,major,python_score):
self._students_number=students_number
self._studens_name=studens_name
self._major=major
self._python_score=python_score
def score(self):
return print(f"{self._studens_name}的python课程分数{self._python_score}",end="\n")
def modify_score(self,sore):
self._python_score=sore
def info(self):
print(f"学号:{self._students_number}")
print(f"姓名:{self._studens_name}")
print(f"专业:{self._major}")
#测试类
def main():
a1=StudentDoc("202013170066","Bob","生态学",90)
a2=StudentDoc("202013170052","Mary","生态学",85)
a1.info()
a2.info()
a1.score()
a2.score()
if __name__ == '__main__':
print('模块信息: ', __doc__)
print('StudentDoc类信息: ', StudentDoc.__doc__)
main()
import student#导入模块
s1=student.StudentDoc("202013170066","Bob","生态学",90)
s2=student.StudentDoc("202013170052","Mary","生态学",85)
s1.modify_score(75)
s1.info()
s1.score()
s2.modify_score(60)
s2.info()
s2.score()
调用自定义函数未成功,无截图
总结
以上是内存溢出为你收集整理的实验5全部内容,希望文章能够帮你解决实验5所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)