Cross and dot product of vector

Cross product

Dot product

import numpy as np

try:

    def pprint(vec):

        t=['i','j','k']

        l={k:v for (k,v) in zip(t, vec)}

        print(l)


    x = [int(i) for i in input("enter the vector in the format xi+yj+zk separated by ',' ").split(',')]


    y = [int(i) for i in input("enter the vector in the format xi+yj+zk separated by ',' ").split(',')]

    if len(x)==3 and len(y)==3:


        print("X=  ",end="")

        pprint(x)

        print("Y=  ",end="")

        pprint(y)

        c=np.cross(x,y)


        d=np.dot(x,y)

        print("XxY=",end="")

        pprint(c)

        print("Dot product is X.Y ",d)

    else:

        raise Exception("vector has 3 direction ")

except Exception as e:

    print(e)