Answer the question
In order to leave comments, you need to log in
Why is the class method not overridden?
class Note:
def __init__(self, name, is_long=False):
note = {'до': 'до-о', 'ре': 'ре-э', 'ми': 'ми-и',
'фа': 'фа-а', 'соль': 'со-оль', 'ля': 'ля-а', 'си': 'си-и'}
self.long = is_long
if not is_long:
self.name = name
else:
self.name = note[name]
def play(self):
print(self.name)
def __str__(self):
return self.name
class LoudNote(Note):
def play(self):
print(self.name.upper())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question