Skip to main content
7 of 7
replaced http://stackoverflow.com/ with https://stackoverflow.com/

Python 2, 48 47 50 bytes

Very simple; follows the standard equation:

lambda a,b,c,d,e,f:abs(a*(d-f)+c*(f-b)+e*(b-d))/2.

The other, similarly simple approaches are longer:

def a(a,b,c,d,e,f):return abs(a*(d-f)+c*(f-b)+e*(b-d))/2. # 57
lambda t:abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2. # 67
def a(t):return abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2. # 74

Python's access to a determinate function is through numpy.

Thanks to muddyfish for 1 byte and xnor for catching an error.

Celeo
  • 530
  • 4
  • 12