These are a few simple examples of problems to solve in python, python code to debug and optimise. There are also some solutions (but do not look at them before trying this yourself).
The workshop has examples you can try in any order, please decide which of the examples you would like to try first.
Where to get help
You can ask in the help session, the main python website is here. A google search will usually be helpful. The best resource is someone you can ask for advice who is working in the same area as you.
From the bottom up
The examples start from the basics. Once you understand the details and how things fit together, you have the power to learn more on your own.
The material
Introduction slides
All of the lessons taught in the workshop are available online, so that you can study at your own pace after the workshop. We strive to make the lessons compact but there are many, many other examples on the web and in books
There are more problems than you can complete (unless you are very good) today, feel free to try them later if you wish.
All of the examples use the default python libraries and also numpy in the example solutions. You can get away without numpy but will require you to write a bit more code yourself.
Some examples of what you can do with python and jupyter
Jupyter codeNote on downloading Jupyter workbooks: the workbook must be saved to a local file, using "Save As..." then openned from with Jupyter. Some webbrowsers add a extra .txt to the end when saving, which is wrong and should be removed.
Code to write
- Evaulate the mean, mode and median of a list of numbers Python code Jupyter code
- Convert a text string into Morse code and back Python code Jupyter code
- Simulate a queue and estimate the maximum wait (note this is a more difficult example) Python code Jupyter code
Code to Debug
- Examples using Unit Tests Python code Jupyter code
- Example of fitting a function Jupyter code
- Finding the most significant peaks in a gamma spectrum (note this is a more difficult example) Jupyter code
Eu152.mat (Data file)
Code to optimise
- Sieve of Eratosthenes Python code Jupyter code