← Back to challenges

Find the Area of a (Regular) Hexagon

PythonHardalgorithmsmathgeometry

Instructions

Given the side length x find the area of a hexagon.

Formula to find the area of a hexagon

Examples

area_of_hexagon(1) ➞ 2.6

area_of_hexagon(2) ➞ 10.4

area_of_hexagon(3) ➞ 23.4

Notes

  • Return None if the side length given is not a positive integer.
  • Round to the nearest tenth.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: RegEx XVIII: Fixed Quantifiers