Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added img/interactive_python.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/your_first_script.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 21 additions & 7 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ Packages for everything!

:::

# Interactive Python

{{< include slides/interactive_python.qmd >}}

# Basics of Python

{{< include slides/basics.qmd >}}
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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`)

:::
14 changes: 0 additions & 14 deletions slides/working_with_python.qmd → slides/IDEs.qmd
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
23 changes: 22 additions & 1 deletion slides/first_script.qmd
Original file line number Diff line number Diff line change
@@ -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

::: {.fragment .fade-in}
Demo time! 🧑🏻‍💻👩🏻‍💻
:::

::: {.fragment .fade-in}
![](/img/your_first_script.png){width=70%}
:::
3 changes: 1 addition & 2 deletions slides/functions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
:::
Expand Down Expand Up @@ -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`
:::

Expand Down
20 changes: 20 additions & 0 deletions slides/interactive_python.qmd
Original file line number Diff line number Diff line change
@@ -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%}
:::