def median(values):
 values = sorted(values)
 length = len(values)
 mid = (length // 2)
 if (length % 2):
  return values[mid]
 else:
  return ((values[(mid - 1)] + values[mid]) / 2)

def median ( values ) : values = sorted ( values ) length = len ( values ) mid = ( length // 2 ) if ( length % 2 ) : return values [ mid ] else : return ( ( values [ ( mid - 1 ) ] + values [ mid ] ) / 2 )
performs median/wpgmc linkage .