Triangle

Report a typo

Suppose we defined the following abstract base class as a template for creating triangles:

from abc import ABC, abstractmethod


class Triangle(ABC):
    def __init__(self, triangle_type, a, b, c):
        self.triangle_type = triangle_type
        self.a = a
        self.b = b
        self.c = c
        super().__init__()

    @abstractmethod
    def print_important_formulae(self):
        pass

    def print_summary(self):
        print('The type of the triangle is: ' + self.triangle_type)
        print('The lengths of the sides are: ' + str(self.a) + ', ' + str(self.b) + ', ' + str(self.c))

We also declared the subclass EquilateralTriangle and created an instance of it:

class EquilateralTriangle(Triangle):
    def print_important_formulae(self):
        ...


triangle = EquilateralTriangle('equilateral', 5, 5, 5)

What will be the output of the following line of code?

triangle.print_summary()
Select one option from the list
___

Create a free account to access the full topic