Create a new rectangle of width w and height h


Class Rectangle:

""" A rectangle with a width and height. """

def __init__(self, w, h):
""" (Rectangle, number, number)

Create a new rectangle of width w and height h.

>>> r = Rectangle(1, 2)
>>> r.width
1
>>> r.height
2
"""

self.width = w
self.height = h

def area(self):
""" (Rectangle) -> number

Return the area of this rectangle.
>>> r = Rectangle(10, 20)
>>> r.area()
200
"""

return self.width * self.height


class RectangleCollection:

def __init__(self):
""" (RectangleCollection) -> NoneType

>>> rc = RectangleCollection()
>>> rc.rectangles
[]
"""
#complete the code here...  

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Create a new rectangle of width w and height h
Reference No:- TGS081722

Expected delivery within 24 Hours