Write two Python classes Square and NGon as follows: NGon objects are initialized with several comma-separated floats, representing the side lengths of a closed polygon. For instance, 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 the number of arguments can vary. If fewer than 3 arguments are provided, your code must raise an error message. NGon provides a perimeter() method, which returns the sum of the 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(). The conversion must return a string of the form ‘Tam a[n) x-gon. Here x is the appropriate number of sides. The Square class inherits the perimeter() method from the NGon class. Square objects are initialized with a single argument — the side length, e.g.. Square(5.0) initializes a square with side length 5.0. When square objects are converted to a string, they return a string of the form ‘I am a square with area y. Here y is the area of the square. Show transcribed image text Write two Python classes Square and NGon as follows: NGon objects are initialized with several comma-separated floats, representing the side lengths of a closed polygon. For instance, 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 the number of arguments can vary. If fewer than 3 arguments are provided, your code must raise an error message. NGon provides a perimeter() method, which returns the sum of the 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(). The conversion must return a string of the form ‘Tam a[n) x-gon. Here x is the appropriate number of sides. The Square class inherits the perimeter() method from the NGon class. Square objects are initialized with a single argument — the side length, e.g.. Square(5.0) initializes a square with side length 5.0. When square objects are converted to a string, they return a string of the form ‘I am a square with area y. Here y is the area of the square.

## Expert Answer

Answer to Write two Python classes Square and NGon as follows: NGon objects are initialized with several comma-separated floats, r…