A floor planner holds a mix of shapes. The starter code gives you Shape(name). Don't change it.
Write three children of Shape. Each has its own __init__ that passes its name up to the parent, and its own area():
| Class | Made with | name | area() |
|---|---|---|---|
Square | Square(side) | "square" | side × side |
Rectangle | Rectangle(width, height) | "rectangle" | width × height |
Triangle | Triangle(base, height) | "triangle" | base × height ÷ 2 |
Then write two functions that work on a list of any mix of these shapes:
total_area(shapes) returns the sum of all the areas, rounded to 2 decimal places. An empty list gives 0.largest_name(shapes) returns the name of the shape with the biggest area. If two shapes tie, return the one that comes first in the list. An empty list gives "none".