Skip to content

Commit

Permalink
Update Python_walkthrough.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoalopez committed Feb 20, 2024
1 parent 8c2436d commit 74b5578
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions notebooks/Python_walkthrough.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'nextafter', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc', 'ulp']\n"
"['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'cbrt', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'exp2', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'nextafter', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc', 'ulp']\n"
]
}
],
Expand Down Expand Up @@ -1617,9 +1617,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Use the ``SimpleNamespace`` method to store related variables (and keep things tidy)\n",
"## Use ``SimpleNamespace`` to store related variables (and keep things tidy)\n",
"\n",
"Python ``SimpleNamespace`` method provides an easy way to store related variables and keep things tidy without the need of using a Python dictionary or generate a very large number of variables in the scope. ``SimpleNamespace`` has the advantage over Python dictionaries of accessing the values using the \"dot\" notation, this is using the syntax ``varname.attribute`` instead of ``varname['attribute']``.\n",
"Python ``SimpleNamespace`` method provides an easy way to store related variables and keep things tidy without the need of using a Python dictionary or generate a very large number of variables in the scope. The main practical difference between ``SimpleNamespace`` and Python dictionaries is that for ``SimpleNamespace`` objects we access the fields using the \"dot\" notation, this is using the syntax ``varname.attribute`` instead of ``varname['attribute']``.\n",
"\n",
"For example, imagine that we want to set a threesome of coordinates. In this case, instead of generating three different variables, it would be more convenient to use a single name called ``coordinates`` containing the different values of the coordinates within that _object_ called ``coordinates`` as follows"
]
Expand Down Expand Up @@ -2024,7 +2024,7 @@
"source": [
"# Python functions\n",
"\n",
"A **function** in Python is a self-contained block of code that encapsulates a specific task or group of related tasks. We have already used several built-in Python functions in this notebook, e.g. ``print()``, or functions belonging to different modules such as ``math.log()``. Python allows the user to define their own functions. For this, first use the keyword ``def`` (meaning _define_) followed by the **name of the function**, a tuple which may be empty or contain one or multiple **arguments** or **parameters** of the function, and a colon. Below this, goes the (indented) code block that do the task(s) as follows\n",
"A **function** in Python is a compact self-contained block of code that executes some action (preferably) or group of actions. We have already used several built-in Python functions in this notebook, e.g. ``print()``, or functions belonging to different modules such as ``math.log()``. Python allows the user to define their own functions. For this, first use the keyword ``def`` (meaning _define_) followed by the **name of the function**, a tuple which may be empty or contain one or multiple **arguments** or **parameters** of the function, and a colon. Below this, goes the (indented) code block that do the task(s) as follows\n",
"\n",
"```python\n",
"def function_name(\"sequence of parameters if any\"):\n",
Expand Down Expand Up @@ -2373,8 +2373,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Notebook tested in 2024-01-09 using:\n",
"Python 3.10.13 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:15:57) [MSC v.1916 64 bit (AMD64)]\n"
"Notebook tested in 2024-02-20 using:\n",
"Python 3.11.5 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:16:22) [MSC v.1916 64 bit (AMD64)]\n"
]
}
],
Expand Down Expand Up @@ -2407,7 +2407,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 74b5578

Please sign in to comment.