Java教程

实验五

本文主要是介绍实验五,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!



class StudentDoc:
    def __init__(self,xh,name,zy,fs):
        self._xh=xh
        self._name=name
        self._zy=zy
        self._fs=fs
    def info(self):
        print(f'学号:{self._xh}')
        print(f'姓名:{self._name}')
        print(f'专业;{self._zy}')
        print(f'python分数:{self._fs}')
    def get_fs(self):
        return self._fs
    def xg_fs(self,newfs):
        self._fs=newfs
        return newfs
def main():
    a1 = StudentDoc('445990426', 'Anjor', 'python', '88')
    a1.xg_fs(66)
    a1.info()
if __name__ == '__main__':
    main()

from student import StudentDoc as www
u1 = www('123','456','789','0')
u1.xg_fs(66)
u1.info()
u2 = www('321','654','987','00')
u2.info()

 

这篇关于实验五的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!