12/18 Inheritance Syntax


class Shape(object):
    """Makes shapes!"""
    def __init__(self, number_of_sides):
        self.number_of_sides = number_of_sides

# Add your Triangle class below!

class Triangle(Shape):
    def __init__(self, side1, side2, side3):
        self.side1 = side1 
        self.side2 = side2
        seld.side3 = side3

I don't know what is wrong... it says
Oops, try again. Did you create a class called Triangle?



seld.side3 = side3

you misspelled self


hi, you may try this out:
1. change seld.side3 = side3
2. put below statement out of the class Triangle to print the result
my_triangle = Triangle(3, 4, 5)
print my_triangle


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.