假设有一段代码,其中: Word 类和一对从第一个类继承的 Noun 和 Verb 类。尝试编译时,在添加 Noun("dog") 的第一个实例时,出现错误:TypeError: __init__() takes 1 positional argument but 2 were given
class Word:
def __init__(self, text):
self.text = text
class Noun(Word):
def __init__(self):
self.part = "существительное"
class Verb(Word):
def __init__(self):
self.part = "глагол"
words = []
words.append(Noun("собака"))
words.append(Verb("ела"))
words.append(Noun("колбасу"))
请帮忙 - 我不知道我做错了什么。