# 0604.py class vettore: def __init__(A,x,y,z): A.x=float(x); A.y=float(y); A.z=float(z) def __add__(A,B): return vettore(A.x+B.x,A.y+B.y,A.z+B.z) def __mul__(A,t): return vettore(A.x*t,A.y*t,A.z*t) def __rmul__(A,t): return A*t def coeff(A): return [A.x,A.y,A.z] def ps (A,B): return A.x*B.x+A.y*B.y+A.z*B.z def pv (A,B): (x,y,z)=A.coeff(); (u,v,w)=B.coeff() return vettore(y*w-z*v,z*u-x*w,x*v-y*u) a=vettore(2,3,5) b=vettore(1,7,2) c=vettore(0,1,8) d=vettore(4,0,-1) e=3*(a+b)+c+d print (e.coeff()) # [13.0, 31.0, 28.0]