Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/CodeWithHarry/The-Ultimate-Python-Course
/ __add__
Method
__add__
Chapter 11 - PS/06_problem6.py:7–9 ·
view source on GitHub ↗
(self, other)
Source
from the content-addressed store, hash-verified
5
self.z = z
6
7
def
__add__(self, other):
8
result = Vector(self.x + other.x, self.y + other.y, self.z + other.z)
9
return
result
10
11
def
__mul__(self, other):
12
result = self.x * other.x + self.y * other.y + self.z * other.z
Callers
nothing calls this directly
Calls
1
Vector
Class · 0.70
Tested by
no test coverage detected