Python with Exercises#
This course provides a (quick) introduction to Python. We assume you have done at least a little programming, but are probably not doing it every day.
The primary focus here is on exercises rather than long lectures. You learn by doing. 80% of your time in this course should be spent either writing code or explaining your solutions to problems.
Specific course goals#
By the end of this course:
Given a problem, you should be able to open your laptop and within minutes be writing Python code to solve that problem.
You will be familiar with all of the core Python language and a number of the most important Python ecosystem libraries.
You will be familiar with JupyterLab and Jupyter notebooks.
You should be set up in GitHub and be familiar with creating and using repositories.
Skills development: 10, 100, 1000, 10000 hours#
In his book Outliers, author and journalist Malcolm Gladwell famously posited a “10,000 hour rule”: that achieving elite world-class expertise at a given skill takes dedicated and focused practice for periods of order 10,000 hours. A PhD (or PhD+postdoc) is arguably a time commitment of this level!
That said, most of us are not aiming to be the world’s leading expert for some specific given skill (e.g. chess grand master), but instead to be competent at a wide number of skills that taken together we need as part of our careers as scientists.
A more appropriate goal is perhaps the “100 hour rule”, which stipulates that with 100 hours of dedicated effort we can become “competent” at these skills. You are -not- an “expert”, but qualitatively and noticeably more skilled than a complete novice. You are comfortable enough with all of the basics that you can just “get to work” and do useful things. Most importantly, it has become much easier to autonomously incorporate new knowledge piecemeal as you practice the skill.
These “rules” are clearly just figures of merit (order of magnitude estimations) of effort required, but they do frame qualitative goals for us. (What does 1000 hours then represent?) All such things happen on a continuum and vary by the particular skill, so who really knows? But “100 hours” is both doable and you will be qualitatively in a different place in terms of your ability to actually use the skill. So let’s aim for that!
The most important thing is to note that these rules are about
**active practice**. You need to *exercise* the muscle to make it stronger.
This course aims to put you solidly on the road to being a competent Python programmer and do many things to enable your scientific research. From there, if you remain open to learning and continue to use the skill you will naturally evolve into an expert.
Some tips:#
Remember at all times that actual coding is how you make progress, whether towards 100 hours or 10000 hours.
If you need to look up syntax or examples of something in the documentation, on the web or via ChatGPT or similar, do not simply cut and paste code from any of those places into your own code. Your goal at the moment is not to be “efficient”, it is to learn. (Re)typing the code yourself will force you to think through and understand the code in question.
When in doubt as to how something behaves, don’t just look it up or ask ChatGPT. Try it! Play with code snippets and simplified code constructions. Use the integrated API help available in Jupyter.