Question OOP-ABS-0044
MediumWhat is the output of this code?
from abc import ABC, abstractmethod
class A(ABC):
@abstractmethod
def f(self): ...
@abstractmethod
def g(self): ...
class B(A):
def f(self): return 1
try:
B()
print("ok")
except TypeError:
print("abstract")
- A.
1
- B.
ok
- C.
None
- D.
abstract
Sign up free to see the answer and a step-by-step explanation.