NotImplementedError until they do.
class Shape:
def area(self):
raise NotImplementedError
def describe(self):
return f"area {self.area()}"
class Square(Shape):
def __init__(self, s):
self.s = s
def area(self):
return self.s * self.s
class Blob(Shape):
pass
Each line below is run on its own, after these classes. Which of them run without raising an exception? Select all that apply.One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.
Log in to join the discussion.
Loading…