Count of Equilateral Triangles of unit length possible from a given Hexagon | Function to calculate the the number of Triangles possible ; Regular Hexagon ; Irregular Hexagon
def calculateTriangles ( sides ) : NEW_LINE INDENT count = pow ( sides [ 0 ] + sides [ 1 ] + sides [ 2 ] , 2 ) NEW_LINE count -= pow ( sides [ 0 ] , 2 ) NEW_LINE count -= pow ( sides [ 2 ] , 2 ) NEW_LINE count -= pow ( sides [ 4 ] , 2 ) NEW_LINE return int ( count ) NEW_LINE DEDENT sides = [ 1 , 1 , 1 , 1 , 1 , 1 ] NEW_LINE print ( calculateTriangles ( sides ) ) NEW_LINE sides = [ 2 , 2 , 1 , 3 , 1 , 2 ] NEW_LINE print ( calculateTriangles ( sides ) ) NEW_LINE