题解 | #多部门的打工人#

多部门的打工人

https://www.nowcoder.com/practice/e704f2c5c30c4aa0b1de9e71bc584fb3

class Nowcoder:
    name = None
    ID = None
    num = None

    def __init__(self, name, ID, num) -> None:
        self.name = name
        self.ID = ID
        self.num = num

    def printInformation(self, name, ID, num, language):
        print(f"{name}'s ID is {ID}, and his or her number of signing in is {num}.")
        print(language)


class IT(Nowcoder):
    language = None

    def __init__(self, name, ID, num, language):
        super(IT, self).__init__(name, ID, num)
        self.language = language


class Designer(Nowcoder):
    color = None

    def __init__(self, name, ID, num, color):
        super(Designer, self).__init__(name, ID, num)
        self.color = color


name1, ID1, num1, language1 = input().split()
name2, ID2, num2, color2 = input().split()
it = IT(name1, ID1, num1, language1)
it.printInformation(name1, ID1, num1, language1)
designer = Designer(name2, ID2, num2, color2)
designer.printInformation(name2, ID2, num2, color2)

全部评论

相关推荐

05-27 14:57
西北大学 golang
强大的社畜在走神:27届真不用急,可以搞点项目、竞赛再沉淀沉淀,我大二的时候还在天天打游戏呢
投递华为等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务