Python How Tos
This section will provide ‘how-to’s on many basic concepts in Python, Numpy, Scipy and Jupyter Notebooks…
The aim of this is to provide a reference for anyone who needs reminding of how to do certain tasks in Python.
The links below will take you to the UCD Physics ‘How-To’ repository on GitHub.
From any of the HowTo Notebooks on Github you can click the ‘open in colab’ link which
will open a copy of the page in Google Colab where you can easily run the code
yourself and edit it to check if the changes do as you expect !
The Jupyter notebooks should be rendered
statically on Github from which you can click the colab link to open
in Google Colab. However, some old browsers do not show the GitHub-rendered
notebooks. If the notebooks do not render then please try another
browser.
Table of Contents
Fundamental Python
- Guide to formatting your code
- How to use strings.
- How to use f-strings.
- How to use lists.
- How to use tuples.
- How to use dictionaries.
- How to use sets.
- How to use logical conditions (incl.
if, elif, else
statements) - How to write
for
loops. - How to write
while
loops. - How to write and use functions.