Определить класс Vector, работающий с трёхмерными векторами Вектора должны поддерживать:

A = Vector(1,2,3)
B = Vector(-1,3,-2)
C = Vector(7,3,5)
print("A, B, C:", A, B, C)
print(A, "+", B, "=", A+B)
print(A, "-", C, "=", A-C)
print(A, "*", 2, "=", A*2)
print(2, "*", B, "=", 2*B)
print(C, "/", 3, "=", C/3)
print(B, "@", C, "=", "{:.2f}".format(B@C))

A, B, C: 1.00:2.00:3.00 -1.00:3.00:-2.00 7.00:3.00:5.00
1.00:2.00:3.00 + -1.00:3.00:-2.00 = 0.00:5.00:1.00
1.00:2.00:3.00 - 7.00:3.00:5.00 = -6.00:-1.00:-2.00
1.00:2.00:3.00 * 2 = 2.00:4.00:6.00
2 * -1.00:3.00:-2.00 = -2.00:6.00:-4.00
7.00:3.00:5.00 / 3 = 2.33:1.00:1.67
-1.00:3.00:-2.00 @ 7.00:3.00:5.00 = -8.00


CategoryHomework

LecturesCMC/PythonIntro2017/Homework_SimpleVector (последним исправлял пользователь FrBrGeorge 2017-11-19 13:49:06)