PROGRAMMING:New calculator
###Topic: design a calculator, to achieve a three-dimensional vector addition, subtraction and vector and scalar multiplication and division operations
###Tips:
1. Define a class named veccal, design a constructor to create a 3D vector object: ` def__ init__( Self, x = 0, y = 0, z = 0 ` use x, y, Z to refer to the values of three dimensions
2. Rewrite the operations of addition (+), subtraction (-), multiplication (*) and division (/ /) to realize the addition, subtraction, multiplication and division of vectors
3. When the input scalar number is 0, the division result is (0, 0, 0)
Example of addition:
```
def __ add__( Self, n): # addition
Result = veccal() # defines the result variable, which is also a three-dimensional vector created by the constructor
result.X = self.X + n.X
result.Y = self.Y + n.Y
result.Z = self.Z + n.Z
Return result # returns the vector result after the addition operation
```
###Input format:
The first line input a three-dimensional vector, separated by commas, such as: 1, 2, 3
Enter another three-dimensional vector in the second line, separated by commas: for example: 4, 5, 6
Enter a number in the third line, such as 3
###Output format:
(1, 2, 3) + (4, 5, 6) = (5, 7, 9)
(1, 2, 3) - (4, 5, 6) = (-3, -3, -3)
(1, 2, 3) * 3 = (3, 6, 9)
(1, 2, 3) / 3 = (0, 0, 1)
###Input example:
Here is a set of inputs. For example:
```in
1,2,3
4,5,6
three
```
###Output example:
The corresponding output is given here. For example:
```out
(1, 2, 3) + (4, 5, 6) = (5, 7, 9)
(1, 2, 3) - (4, 5, 6) = (-3, -3, -3)
(1, 2, 3) * 3 = (3, 6, 9)
(1, 2, 3) / 3 = (0, 0, 1)
```
answer:If there is no answer, please comment
###Tips:
1. Define a class named veccal, design a constructor to create a 3D vector object: ` def__ init__( Self, x = 0, y = 0, z = 0 ` use x, y, Z to refer to the values of three dimensions
2. Rewrite the operations of addition (+), subtraction (-), multiplication (*) and division (/ /) to realize the addition, subtraction, multiplication and division of vectors
3. When the input scalar number is 0, the division result is (0, 0, 0)
Example of addition:
```
def __ add__( Self, n): # addition
Result = veccal() # defines the result variable, which is also a three-dimensional vector created by the constructor
result.X = self.X + n.X
result.Y = self.Y + n.Y
result.Z = self.Z + n.Z
Return result # returns the vector result after the addition operation
```
###Input format:
The first line input a three-dimensional vector, separated by commas, such as: 1, 2, 3
Enter another three-dimensional vector in the second line, separated by commas: for example: 4, 5, 6
Enter a number in the third line, such as 3
###Output format:
(1, 2, 3) + (4, 5, 6) = (5, 7, 9)
(1, 2, 3) - (4, 5, 6) = (-3, -3, -3)
(1, 2, 3) * 3 = (3, 6, 9)
(1, 2, 3) / 3 = (0, 0, 1)
###Input example:
Here is a set of inputs. For example:
```in
1,2,3
4,5,6
three
```
###Output example:
The corresponding output is given here. For example:
```out
(1, 2, 3) + (4, 5, 6) = (5, 7, 9)
(1, 2, 3) - (4, 5, 6) = (-3, -3, -3)
(1, 2, 3) * 3 = (3, 6, 9)
(1, 2, 3) / 3 = (0, 0, 1)
```
answer:If there is no answer, please comment