题解 | #多部门的打工人#
多部门的打工人
https://www.nowcoder.com/practice/e704f2c5c30c4aa0b1de9e71bc584fb3?tpId=344&tqId=10091340&ru=/exam/oj&qru=/ta/vip-python/question-ranking&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3DPython%25E7%25AF%2587%26topicId%3D344
class Nowcoder:
def __init__(self, name, ID, num):
self.name = name
self.ID = ID
self.num = num
def pI(self):
print(
"{}'s ID is {}, and his or her number of signing in is {}.".format(self.name,self.ID,self.num)
)
class IT(Nowcoder):
def __init__(self,name,ID,num,language):
super(IT, self).__init__(name, ID, num)
self.language = language
def pI(self):
super().pI()
print(self.language)
class Designer(Nowcoder):
def __init__(self, name, ID, num, color):
super(Designer, self).__init__(name, ID, num)
self.color = color
def pI(self):
super().pI()
print(self.color)
a=input().split()
a1=IT(a[0],a[1],a[2],a[3])
a1.pI()
b=input().split()
a2=Designer(b[0],b[1],b[2],b[3])
a2.pI()
查看9道真题和解析
