首页 > 其他 > 详细

实验5

时间:2021-06-01 15:27:05      阅读:26      评论:0      收藏:0      [点我收藏+]
class StudentDoc:
    def __init__ (self,number,name,major,score):
        self.number=number
        self.name=name
        self.major=major
        self.score=score

    def info(self):
        print(f{self.number},{self.name},{self.major},{self.score})

    def get_score(self):
        return self.score

    def change_score(self,change):
        self.score=change

技术分享图片

from student import StudentDoc
s1=StudentDoc(110120119,喀喀喀,耷拉巴拉,0)
s2=StudentDoc(119120110,吼吼吼,,1)

s1.info()
s2.info()

print(f分数:,s1.get_score())
print(f分数:,s2.get_score())

s1.change_score(100)
s2.change_score(100)
print(f分数:,s1.get_score())
print(f分数:,s2.get_score())

技术分享图片

实验5

原文:https://www.cnblogs.com/ChuYou-Li/p/14836078.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!