From c375f9ad99f27d5e9cbedafa8a67c0445331adae Mon Sep 17 00:00:00 2001 From: "Mr. Enrico" Date: Mon, 13 Feb 2023 11:19:43 -0500 Subject: [PATCH 1/2] Add empty main.py --- main.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..e69de29 From 9b73b9ea177f7c35583af170a35865c98bd80c27 Mon Sep 17 00:00:00 2001 From: Valeska Escalante <121885214+evaleska@users.noreply.github.com> Date: Wed, 15 Feb 2023 13:30:24 +0000 Subject: [PATCH 2/2] working branch --- .gitignore | 4 ++++ instructions.md | 18 ++++++++++++++++++ main.py | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 instructions.md diff --git a/.gitignore b/.gitignore index b6e4761..dbb8fb7 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,7 @@ dmypy.json # Pyre type checker .pyre/ + +# Replit stuff +replit.nix +.replit diff --git a/instructions.md b/instructions.md new file mode 100644 index 0000000..df71c0c --- /dev/null +++ b/instructions.md @@ -0,0 +1,18 @@ +# Designing a Simple 2d Vector Class + +## Instructions + +- 2/14/23 + - Before changing **anything**, check out a new branch in which to work. + + - Write an `__init__` method for `Vector2d` that has positional parameters for the `x` and `y` components that correspond to the *instance variables* `self.x` and `self.y` + + - Write a `__repr__` method for the `Vector2d` class that returns a string such that `Vector2d(3, 4) == eval(repr(Vector2d(3, 4)))` is `True` + + - Write a `__str__` method for the `Vector2d` class such that `str(Vector2d(3, 4))` would return `'3i + 4j'`. (**i** and **j** are what many physicists and engineers use to denote the x and y directions) + + - Write an `__abs__` function that takes `self` as its only argument and returns the length of the hypotenuse of the right triangle with legs equal to `self.x` and `self.y`. For example, `abs(Vector2d(3, 4))` should return `5.0`. + + - Once you've finished today's work, commit your changes and push them to **your** repository. + + diff --git a/main.py b/main.py index e69de29..104be10 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,2 @@ +class Vector2d: + pass \ No newline at end of file