diff --git a/img/interactive_python.png b/img/interactive_python.png new file mode 100644 index 0000000..a4bcc66 Binary files /dev/null and b/img/interactive_python.png differ diff --git a/img/your_first_script.png b/img/your_first_script.png new file mode 100644 index 0000000..53dde5e Binary files /dev/null and b/img/your_first_script.png differ diff --git a/index.qmd b/index.qmd index bf9dc70..06d0966 100644 --- a/index.qmd +++ b/index.qmd @@ -140,6 +140,10 @@ Packages for everything! ::: +# Interactive Python + +{{< include slides/interactive_python.qmd >}} + # Basics of Python {{< include slides/basics.qmd >}} @@ -164,9 +168,9 @@ Packages for everything! {{< include slides/errors_and_exceptions.qmd >}} -# How to work with Python? +# IDEs -{{< include slides/working_with_python.qmd >}} +{{< include slides/IDEs.qmd >}} # Virtual environments @@ -185,7 +189,9 @@ Packages for everything! {{< include slides/documenting_your_code.qmd >}} # Next steps -## Next steps {.smaller .incremental} +## Next steps {.smaller} + +::: {.incremental} * We've covered some of the basics * Next steps -- Practice!: + Mess around with code @@ -195,15 +201,20 @@ Packages for everything! + Additional courses ::: -## Further resources {.smaller .incremental} +## Further resources {.smaller} + +::: {.incremental} * [CS50](https://pll.harvard.edu/course/cs50-introduction-computer-science) * UCL ARC courses + [An introduction to programming for research using Python](https://rits.github-pages.ucl.ac.uk/doctoral-programming-intro/) + [Research software engineering with Python](https://github-pages.ucl.ac.uk/rsd-engineeringcourse/) + [Software carpentry courses](https://software-carpentry.org/lessons/) + [Exercism](https://exercism.org/tracks/python) +::: -## Troubleshooting tips {.smaller .incremental} +## Troubleshooting tips {.smaller} + +::: {.incremental} * Make sure the correct environment is activated + `which python` or `which pip` to check * Check the scope of your variable @@ -213,6 +224,7 @@ Packages for everything! + `pyproject.toml` → more on this in future sessions! * Look out for deep vs shallow copies + Especially with collections (lists, dicts, sets) +::: ## Question ::::: {.columns} @@ -236,11 +248,13 @@ print(a[0]) ::::: -## Troubleshooting tips {.smaller .incremental} +## Troubleshooting tips {.smaller} + +::: {.incremental} * Read the error messages! + Google is your friend + LLMs can help too + Ask a colleague or contact us * Use a debugger (e.g. `pdb`, or IDE built-in debuggers) * Write tests for your code (e.g. using `pytest`) - +::: diff --git a/slides/working_with_python.qmd b/slides/IDEs.qmd similarity index 76% rename from slides/working_with_python.qmd rename to slides/IDEs.qmd index 2f7e16e..7baff47 100644 --- a/slides/working_with_python.qmd +++ b/slides/IDEs.qmd @@ -1,17 +1,3 @@ -## Ways of working with Python {.incremental} - -::: {.incremental} -* `REPL` (Read-Eval-Print Loop), "interactive Python", "Python console" -* `Jupyter notebooks` (.ipynb) -* `Scripts` (.py) -::: - -::: {.fragment .fade-in} -Demo time! 🧑🏻‍💻👩🏻‍💻 -::: - - - ## IDEs: Integrated Development Environments {.smaller} ::: {.incremental} diff --git a/slides/first_script.qmd b/slides/first_script.qmd index 681423f..c99fc28 100644 --- a/slides/first_script.qmd +++ b/slides/first_script.qmd @@ -1,2 +1,23 @@ +## Ways of working with Python {.incremental} + +::: {.incremental} +* `REPL` (Read-Eval-Print Loop), "interactive Python", "Python console" +* `Jupyter notebooks` (.ipynb) +* `Scripts` (.py) +::: + +::: {.fragment .fade-in} +Demo time! 🧑🏻‍💻👩🏻‍💻 +::: + + + ## Writing your first Python script -* Placeholder slide \ No newline at end of file + +::: {.fragment .fade-in} +Demo time! 🧑🏻‍💻👩🏻‍💻 +::: + +::: {.fragment .fade-in} +![](/img/your_first_script.png){width=70%} +::: \ No newline at end of file diff --git a/slides/functions.qmd b/slides/functions.qmd index 5dffdd1..626dc57 100644 --- a/slides/functions.qmd +++ b/slides/functions.qmd @@ -233,7 +233,6 @@ print(longer_string("apple")) ::: {.incremental .smaller} * `*` and `**` are upacking operators, useful to unpack tuples, lists and dictionaries -* I't common to use `*` and `**` when calling functions * You might have seen the syntax `*args` and `**kwargs` before * This is just a convention to indicate that the function takes a variable number of arguments ::: @@ -291,7 +290,7 @@ my_func(name="Jane") ::: {.incremental .smaller} * Functions can return one or more values * Use the `return` keyword -* A function can only return once +* A function can have multiple return statements but only one will be executed * If no return statement is given, the function returns `None` ::: diff --git a/slides/interactive_python.qmd b/slides/interactive_python.qmd new file mode 100644 index 0000000..9c143f6 --- /dev/null +++ b/slides/interactive_python.qmd @@ -0,0 +1,20 @@ +## Ways of working with Python {.incremental} + +::: {.incremental} +* `REPL` (Read-Eval-Print Loop), "interactive Python", "Python console" +* `Jupyter notebooks` (.ipynb) +* `Scripts` (.py) +::: + + + +## Using interactive Python (REPL) + +::: {.fragment .fade-in} +Demo time! 🧑🏻‍💻👩🏻‍💻 +::: + +::: {.fragment .fade-in} +![](/img/interactive_python.png){width=80%} +::: +