From 59b8b811890072387d6c8eb9946eb7ebfb11e25d Mon Sep 17 00:00:00 2001 From: AngelinaPereyra <121259776+AngelinaPereyra@users.noreply.github.com> Date: Wed, 22 Feb 2023 20:06:20 +0000 Subject: [PATCH 1/3] Complete work for 2/23 in main.py --- main.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 104be10..307371f 100644 --- a/main.py +++ b/main.py @@ -1,2 +1,27 @@ class Vector2d: - pass \ No newline at end of file + + + def __init__ (self,x,y): + self.y = y + self.x = x + + def __repr__(self): + return f"Vector2d(x={self.x}, y={self.y})" == True + + def __str__(self): + return f"{self.x}i+{self.y}j" + + def __abs__(self): + return f"({self.x}**2 + {self.y}**2)**1/5" + + def __neg__(self): + return Vector2d(-self.x, -self.y) + + def __add__(self, other): + return Vector2d(self.x + other.x, self.y + other.y) + + def __eq__(self): + return f"{self.x == self.y}" + + def __sub__(self, another): + return f" Vector2d{self.x - another.x, self.y - another.y}" From 19936f23e6abd6a8ec570a019c9b2dc9d5b7a56a Mon Sep 17 00:00:00 2001 From: AngelinaPereyra <121259776+AngelinaPereyra@users.noreply.github.com> Date: Wed, 22 Feb 2023 20:06:20 +0000 Subject: [PATCH 2/3] Complete work for 2/23 in main.py --- main.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 104be10..307371f 100644 --- a/main.py +++ b/main.py @@ -1,2 +1,27 @@ class Vector2d: - pass \ No newline at end of file + + + def __init__ (self,x,y): + self.y = y + self.x = x + + def __repr__(self): + return f"Vector2d(x={self.x}, y={self.y})" == True + + def __str__(self): + return f"{self.x}i+{self.y}j" + + def __abs__(self): + return f"({self.x}**2 + {self.y}**2)**1/5" + + def __neg__(self): + return Vector2d(-self.x, -self.y) + + def __add__(self, other): + return Vector2d(self.x + other.x, self.y + other.y) + + def __eq__(self): + return f"{self.x == self.y}" + + def __sub__(self, another): + return f" Vector2d{self.x - another.x, self.y - another.y}" From c822ce5ffe6273d0e7c52d67a8f30e1a9579c23b Mon Sep 17 00:00:00 2001 From: AngelinaPereyra <121259776+AngelinaPereyra@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:38:45 +0000 Subject: [PATCH 3/3] completed work from 02/23/2023-02/24/2023 --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 307371f..36142af 100644 --- a/main.py +++ b/main.py @@ -25,3 +25,6 @@ def __eq__(self): def __sub__(self, another): return f" Vector2d{self.x - another.x, self.y - another.y}" + + def angle(self): + return (math.atan2 (self.x, self.y) to math.degrees(x)) \ No newline at end of file