Skip to content

Commit 1f8bf40

Browse files
authored
Update vector2.py
1 parent 267a02b commit 1f8bf40

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

3_advanced/chapter13/examples/vector2.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,40 @@ def __init__(self, vals):
1111
# print("Assigned values ", vals, " to vector.")
1212

1313
"""
14-
String Function
14+
String Function
1515
16-
Converts the object to a string in readable format for programmers
17-
"""
16+
Converts the object to a string in readable format for programmers
17+
"""
1818

1919
def __str__(self):
2020
return str(self.vals)
2121

2222
"""
23-
Elementwise power: raises each element in our vector to the given power
24-
"""
23+
Elementwise power: raises each element in our vector to the given power
24+
"""
2525

2626
def __pow__(self, power):
2727
return Vector([i ** power for i in self.vals])
2828

2929
"""
30-
Addition: adds each element to corresponding element in other vector
31-
"""
30+
Addition: adds each element to corresponding element in other vector
31+
"""
3232

3333
def __add__(self, vec):
3434
return Vector(
3535
[self.vals[i] + vec.vals[i] for i in range(len(self.vals))]
3636
)
3737

3838
"""
39-
Multiplies each element in the vector by a specified constant
40-
"""
39+
Multiplies each element in the vector by a specified constant
40+
"""
4141

4242
def __mul__(self, constant):
4343
return Vector([self.vals[i] * constant for i in range(len(self.vals))])
4444

4545
"""
46-
Elementwise subtraction: does the same as addition, just subtraction instead
47-
"""
46+
Elementwise subtraction: does the same as addition, just subtraction instead
47+
"""
4848

4949
def __sub__(self, vec):
5050
return self + (vec * (-1))

0 commit comments

Comments
 (0)