Issues with Shape inheritance for base classes triangles and squares
<p>I keep getting an error. I want the program to display the area of my triangle class. Here is my code:</p>

<pre><code>#Parent class is Shape class
#Child  class is Triangle and Square class

class Shape:
    def __init__(self,base,height):

        self.base=base
        self.height=height
def triangle_area(self):
    return .5*self.base*self.height

def square_area(self):
    return self.base*self.height


class Triangle(Shape):
    def triangle_area(self):
        return .5*self.base*self.height
class Square(Shape):
    def square_area(self):
        return self.base*self.height










triangle_one=Triangle()
triangle_one.base=9
triangle_one.height=12
print("Area of triangle is",triangle_one.triangle_area())
</code></pre>

<p>And here is my error:</p>

<blockquote>
  <p>BlockquoteTraceback (most recent call last):
    File "C:/Users/Pentazoid/Desktop/PythonPrograms/inheritanceshape.py", line 31, in 
      triangle_one=Triangle()
  TypeError: <strong>init</strong>() missing 2 required positional arguments: 'base' and 'height'</p>
</blockquote>

<p>What am I doing wrong</p>

<p>You need to pass base and height in the constructor call like this:</p>

<pre><code>base=9
height=12
triangle_one=Triangle(base, height)
</code></pre>

python inheritance