From ac56a07049d0f07ca0971fa3bf47983129f457f1 Mon Sep 17 00:00:00 2001 From: freekie224 <60519453+freekie224@users.noreply.github.com> Date: Mon, 17 Apr 2023 14:30:52 +0200 Subject: [PATCH] Update classes.ipynb --- python/classes.ipynb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python/classes.ipynb b/python/classes.ipynb index a70e568f..eb864a0a 100644 --- a/python/classes.ipynb +++ b/python/classes.ipynb @@ -8,7 +8,7 @@ "\n", "In programming, classes, or more general OOP (Object Oriented Programing) is a fundamental paradigm (next to others, e.g. functional programming). It is powerful and e.g. Java is fully based on it. Python is a multi-paradigm (and multi-everything anyway) language, meaning there are classes, functions etc.\n", "\n", - "However, classes play in Python an extremely important role - although one does not directly has to no about it - since actually every object in Python \"comes from a class\". But we're going ahead of things.\n", + "However, classes play in Python an extremely important role - although one does not directly have to know about it - since actually every object in Python \"comes from a class\". But we're going ahead of things.\n", "\n", "Let's start with an example problem" ] @@ -18,7 +18,7 @@ "metadata": {}, "source": [ "We want to do some calculations with particles and their momenta, e.g. to calculate their invariant mass.\n", - "(we focus on just one paricle here, sure we could use lists but this means to keep track of which entry is which etc.)" + "(we focus on just one particle here, sure we could use lists but this means to keep track of which entry is which etc.)" ] }, { @@ -59,7 +59,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Alright, but clearly cumbersom. Better: if we could stick it together. Let's use a dict!" + "Alright, but clearly cumbersome. Better: if we could stick it together. Let's use a dict!" ] }, { @@ -310,7 +310,7 @@ "Exercise: override the `__add__` method to make two particle addable. Name it `Particle`\n", "Hint: you need to construct a new Particle\n", "\n", - "STOP SCROLING, SOLUTION AHEAD!\n", + "STOP SCROLLING, SOLUTION AHEAD!\n", "\n", "\n", "\n", @@ -318,7 +318,7 @@ "\n", "\n", "\n", - "STOP SCROLING, SOLUTION AHEAD!\n", + "STOP SCROLLING, SOLUTION AHEAD!\n", "\n", "\n", "\n", @@ -326,7 +326,7 @@ "\n", "\n", "\n", - "STOP SCROLING, SOLUTION AHEAD!\n", + "STOP SCROLLING, SOLUTION AHEAD!\n", "\n", "\n", "\n", @@ -334,7 +334,7 @@ "\n", "\n", "\n", - "STOP SCROLING, SOLUTION AHEAD!" + "STOP SCROLLING, SOLUTION AHEAD!" ] }, { @@ -405,7 +405,7 @@ "class VerboseParticle(Particle): # This is inheritance\n", " \n", " def momentum_text(self):\n", - " return f\"px: {self.px}, py: {self.py}, pz {self.pz}\"\n", + " return f\"px: {self.px}, py: {self.py}, pz: {self.pz}\"\n", " " ] }, @@ -458,7 +458,7 @@ "\n", "(Sidenote: be aware of `isinstance` vs `type`, use the former if not explicitly type has to be used.)\n", "\n", - "So we can replace the call in `__add__` as follows. Insead of\n", + "So we can replace the call in `__add__` as follows. Instead of\n", "```return Particle(new_px, new_py, new_pz, new_E)```\n", "we have\n", "```return type(self)(new_px, new_py, new_pz, new_E)```\n",