From 856f1a4e33663695fd271a83eb4ba3ec2cf82670 Mon Sep 17 00:00:00 2001 From: Ola Hamza Date: Mon, 16 Mar 2026 20:21:45 +0100 Subject: [PATCH] add vectors task solution --- codewars/thinkful-object drills.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 codewars/thinkful-object drills.py diff --git a/codewars/thinkful-object drills.py b/codewars/thinkful-object drills.py new file mode 100644 index 0000000..a1058d3 --- /dev/null +++ b/codewars/thinkful-object drills.py @@ -0,0 +1,17 @@ +class Vector: + def __init__(self, x, y): + self.x = x + self.y = y + + def add(self, other_vector): + new_x = self.x + other_vector.x + new_y = self.y + other_vector.y + + return Vector(new_x, new_y) + + + def subtract(self, other_vector): + new_x = self.x - other_vector.x + new_y = self.y - other_vector.y + + return Vector(new_x, new_y) \ No newline at end of file