Python Code Camp is designed to provide a brief introduction to programming in Python, the language that we use for a lot of our own research as well as in the 2nd and 3rd years of our undergraduate ‘Spatial Data Science’ pathway. The ‘lessons’ in code camp are provided via ‘notebooks’. The lesson notebooks address individual and quite distinct concepts or topics, but they are designed to be done in a sequence (as shown below).
The first few minutes of our Intro Video explain more about Code Camp and show you how to get started using the Binder link below:
Running Code Camp Online (Start HERE)
If you’ve ended up here because you’ve followed a link online thinking “Hey, I’d kind of like to learn a bit of Python” or because you’ve been reminded by one of us (again) to do Code Camp over the summer, then the simplest way to get started with our notebooks is to use Binder. Binder is a temporary service (i.e. you will lose your work when you log out and you will be booted out if you don’t do anything for a long time) but is a great way to access the lesson notebooks with nothing to install and nothing to download. We recommend using Chrome, Firefox or Safari.
Launch Python Code Camp as a Binder resource:
How will I know if I’ve done the right thing?
Launching Binder may take a couple of minutes. Once Binder has launched, you’ll know that you have been successful if the circles have stopped spinning and your browser tab looks something like the image below:
If your screen does not arrive at a page that looks something like the image above, close the browser tab and try again by clicking the link above again.
Once Binder is open, to open a notebook simply click on the notebook name (in a light blue colour). For example, clicking on notebook-01-getting-started.ipynb should give you a view something like this:
The first three minutes of our Intro Video (above) also show the process of getting started with Code Camp.
Binder will ‘time out’ after a period of non-use. When this happens you will get a message that says something like ‘Connection failed’. You’ll need to close the browser tab and re-start Binder by clicking on the link above again.
If you need some tips on how to use Jupyter Notebooks, DataCamp have made a handy cheat sheet which you can save as a pdf or view as an image:
Downloading Lessons (more Advanced)
The lesson notebooks are all hosted on a code-sharing website called GitHub. Hosting on GitHub allows us to use services like Binder, but it also allows anyone to download the notebook content. If you know how to do download and run yourself, feel free to do so using the links to each notebook below (if you are a new King’s SDS student you’ll learn how to do this in your Year 2 modules and you can stick with the Binder approach above for now):
- Lesson #1: Getting Started
- Lesson #2: Thinking Like a Computer
- Lesson #3: The Basics
- Lesson #4: Dealing with Errors & Debugging
- Lesson #5: Truth with Conditions
- Lesson #6: Recap
- Lesson #7: Lists
- Lesson #8: Dictionaries
- Lesson #9: Loops & Iteration
- Lesson #10: Recap 2
If you have trouble with Binder, you might be able to work out how to use Google Colab to try the notebooks, by combining the GitHub links above with the guide here.
Finding More Resources
If ‘Code Camp’ has whetted your appetite and you want to get more stuck into learning Python without waiting for our classes to start in Year 2, you can try these resources:
- Think Python: the 2nd edition has been updated for Python3.
- Programming in Python: is a good set of interactive lessons.
- Plotting and Programming in Python: this will take you into material covered in our first full module so it might not be a bad place to really get stuck in in preparation for the module.
- For Physical Geographers there are a number of advanced tutorials on Earth Data Science.
- The Unix Shell: this will be really useful in the longer run. On Windows the equivalent is the PowerShell.
- Version Control with Git: we use Git (with hosting on GitHub) to manage our own course material. Many data scientists and software developers make heavy use of version control in order to track and combine work done by different people, ensure that everything is backed up, and to help to track down bugs… a bit more on this below.
More about Git & GitHub
We’ve mentioned that Code Camp is stored on GitHub, but what the heck is that???
GitHub is a website used to store version histories of files containing code; you can think of it as a “Dropbox for programmers”, but it also allows you to easily compare two different versions of your code, to ‘roll back’ to an earlier version (if you break something), and to ‘clone’ or ‘fork’ from work being done and shared by others. GitHub can do much more than this, but for the moment being let’s stop here. If you are interested in learning more about Git and GitHub check out these resources:
The content and structure of this teaching project itself is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license, and the contributing source code is licensed under The MIT License.