From b9f43016620908b5d8ffa9a45e35240a8280e0d2 Mon Sep 17 00:00:00 2001 From: HusseinAWAWADA <121184339+HusseinAWAWADA@users.noreply.github.com> Date: Tue, 21 Feb 2023 16:06:17 +0000 Subject: [PATCH 1/4] Save solutions for 2/16 --- main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 104be10..c63b7c8 100644 --- a/main.py +++ b/main.py @@ -1,2 +1,11 @@ class Vector2d: - pass \ No newline at end of file + def __init__(self, x, y): + self.x= x + self.y= y + def __repr__(self): + return f"Vector2d(x='{self.x}',y='{self.y}')" + def __str__(self): + return f"{self.x}I+{self.y}J" + def __abs__(self): + return ((self.x**2)+(self.y**2)) **(1/2) + \ No newline at end of file From 6b088b0a63c7cc69870ced6d9dcbf0ee1d629cc6 Mon Sep 17 00:00:00 2001 From: HusseinAWAWADA <121184339+HusseinAWAWADA@users.noreply.github.com> Date: Tue, 21 Feb 2023 16:24:53 +0000 Subject: [PATCH 2/4] your msg --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index c63b7c8..eee293c 100644 --- a/main.py +++ b/main.py @@ -8,4 +8,7 @@ def __str__(self): return f"{self.x}I+{self.y}J" def __abs__(self): return ((self.x**2)+(self.y**2)) **(1/2) - \ No newline at end of file + def __neg__(self): + return Vector2d(self.x*-1, self.y*-1) + def __add__(self,rest_of_x): + return Vector2d((self.x+rest_of_x.x), (self.y+rest_of_x.y)) \ No newline at end of file From e894c2d9be0c5d63eba1d870e922e4a506e4b204 Mon Sep 17 00:00:00 2001 From: HusseinAWAWADA <121184339+HusseinAWAWADA@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:06:36 +0000 Subject: [PATCH 3/4] Finished all of HW --- main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index eee293c..43cd67e 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import math class Vector2d: def __init__(self, x, y): self.x= x @@ -11,4 +12,11 @@ def __abs__(self): def __neg__(self): return Vector2d(self.x*-1, self.y*-1) def __add__(self,rest_of_x): - return Vector2d((self.x+rest_of_x.x), (self.y+rest_of_x.y)) \ No newline at end of file + return Vector2d((self.x+rest_of_x.x), (self.y+rest_of_x.y)) + def __eq__(self,other): + return Vector2d((self.x==other.x), (self.y==other.y)) + def __sub__(self,other): + return Vector2d((self.x-other.x), (self.y-other.y)) + def angle(self): + tan=math.atan2(self.x), (self.y) + return math.degrees(tan) \ No newline at end of file From c91014d5ac17d6c0f562d9cb3ea5e0b9e9da9af8 Mon Sep 17 00:00:00 2001 From: HusseinAWAWADA <121184339+HusseinAWAWADA@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:26:08 +0000 Subject: [PATCH 4/4] Changes. --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 43cd67e..d019b64 100644 --- a/main.py +++ b/main.py @@ -11,8 +11,8 @@ def __abs__(self): return ((self.x**2)+(self.y**2)) **(1/2) def __neg__(self): return Vector2d(self.x*-1, self.y*-1) - def __add__(self,rest_of_x): - return Vector2d((self.x+rest_of_x.x), (self.y+rest_of_x.y)) + def __add__(self,other): + return Vector2d((self.x+other.x), (self.y+other.x)) def __eq__(self,other): return Vector2d((self.x==other.x), (self.y==other.y)) def __sub__(self,other):