Write two Python classes Square and NGon as follows:
-NGon objects are initialized with several comma-separatedfloats, representing the side lengths of a closed polygon. Forinstance, NGon(1.0, 1.0, 1.414) would initialize a triangle,NGon(2.0, 3,0, 2.0, 3.0) could describe a rectangle. Note that thenumber of arguments can vary. If fewer than 3 arguments areprovided, your code must raise an error message.
-NGon provides a perimeter() method, which returns the sum ofthe side lengths of the object. For instance,NGon(2.0,3.0,5.0).perimeter() must return 10.0.
-NGon objects can be converted to a string with str(). Theconversion must return a string of the form ‘I am a(n) x-gon.’ Herex is the appropriate number of sides.
-The Square class inherits the perimeter() method from the NGonclass.
-Square objects are initialized with a single argument — theside length, e.g., Square(5.0) initializes a square with sidelength 5.0.
-When square objects are converted to a string, they return astring of the form ‘I am a square with area y.’ Here y is the areaof the square.
Answer to Write two Python classes Square and NGon as follows: -NGon objects are initialized with several comma-separated floats, …