def crossp(a, b):
    '''Cross product of two 3D vectors'''
    assert len(a) == len(b) == 3, 'For 3D vectors only'
    a1, a2, a3 = a
    b1, b2, b3 = b
    return (a2*b3 - a3*b2, a3*b1 - a1*b3, a1*b2 - a2*b1)

def dotp(a,b):
    '''Dot product of two eqi-dimensioned vectors'''
    assert len(a) == len(b), 'Vector sizes must match'
    return sum(aterm * bterm for aterm,bterm in zip(a, b))

def scalartriplep(a, b, c):
    '''Scalar triple product of three vectors: '''
    return dotp(a, crossp(b, c))

def vectortriplep(a, b, c):
    '''Vector triple product of three vectors: '''
    return crossp(a, crossp(b, c))

if __name__ == '__main__':
    a, b, c = (3, 4, 5), (4, 3, 5), (-5, -12, -13)
    print(% (a, b, c))
    print(% dotp(a,b))
    print( % (crossp(a,b),))
    print(% scalartriplep(a, b, c))
    print(% (vectortriplep(a, b, c),))