# 0606.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) a+=b print (a.coeff()) # [3.0, 10.0, 7.0] a*=2 print (a.coeff()) # [6.0, 20.0, 14.0]