Working from a text book the question reads “Implement a class Polygon that abstracts regular polygons and supports class methods:
- __init__(): A constructor that takes as input the number of sides and the side length of a regular n~gon (n-sided polygon) object
- perimeter(): Returns the perimeter of n-gon object
- area(): Returns the area of the n-gon object
To me this is a mouthful but I did my best with what little experience I have and what I have read from the text book I have and the below text is what I have so far.
Any help would be greatly appreciated.
import math
class Polygon:
'Template for a mathematical shape.'
- __init__(): A constructor that takes as input the number of sides and the side length of a regular n~gon (n-sided polygon) object
- perimeter(): Returns the perimeter of n-gon object
- area(): Returns the area of the n-gon object
To me this is a mouthful but I did my best with what little experience I have and what I have read from the text book I have and the below text is what I have so far.
Any help would be greatly appreciated.
import math
class Polygon:
'Template for a mathematical shape.'