Question: **PYTHON** Create a class called Hexagon along with a constructor that takes a side ss. Create two methods to compute: (1) the perimeter P =
**PYTHON**
Create a class called Hexagon along with a constructor that takes a side ss. Create two methods to compute: (1) the perimeter P = 6s and (2) area of the hexagon A = 3/2 * sqrt(3) * s^2
class Hexagon(object): ''' Represents an Hexagon. ''' def __init__(self, side): ''' Return a new Hexagon object. Parameters ---------------- side: A float. Attributes ---------- Hexagon.side: side of a hexagon ''' # YOUR CODE HERE def perimeter(self): """ Compute the perimeter of the hexagon Returns ------- A float. The perimeter of the hexagon. """ # YOUR CODE HERE def area(self): """ Compute the area of the hexagon Returns ------- A float. The area of the hexagon. """ # YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
