Python Challenges page

Can computers be used to create art? How fast can a computer read all of Wikipedia? How long would it take to walk every street in Oxford?

Work out the answers to these questions and more with our series of Explore beyond School mini-projects based on Python, a programming language. At the start of each month we will release a new challenge for aspiring scientists, which you can work on using Python.

These challenges are designed to stretch Year 12 students keen on studying STEM subjects at university. This can be your first taste of Python and you will need to install Python 3 on your computer (available online for free).  When exploring these problems using Python, you will need to use libraries of code compiled by other programmers; Python libraries are called ‘packages’. Solutions are available once you have completed the challenge, but try to get as far as you can on your own before checking the solutions page. See more details below, and on each challenge page.

You will be able to find each challenge when it’s released on this page.

The first challenge 'Can computers be used to create art?' is available here.

The second challenge 'How do computers recognise songs?' is available here.

The third challenge 'How fast can a computer read all of Wikipedia?' is available here.

The fourth challenge 'How long would it take to walk every street in Oxford' is available here.

Visit the University courses page to find out more about the courses offered at Oxford.

 If you have any specific queries or want to let us know how you did, please email us at access@chch.ox.ac.uk.

Each activity will only use software that is freely available online, but will require you to do some research of your own to create a solution

More about each challenge

Each challenge has three resources associated with it:

  1. The challenge page has three targets and three extension problems to attempt.
  2. A ‘Hints and Tips’ section, which can be revealed, and includes some pointers to help you develop your solution. This may include useful or required packages, hints, or notes discussing the extension topics. You should try and work through the challenge first before viewing these!
  3. A downloadable one page solution with the target tasks completed. Have a look at this once you have developed your own solution - compare for readability and run time!

Python setup

It is assumed that you have Python 3 set up on your computer. The challenges will require some packages, although these will be standard packages that are widely used. Any Python setup should work with these packages (e.g. IDLE with pip, or Anaconda). These challenges avoid packages with many dependencies, to make installation more straightforward.

Use of Packages

As with all programming languages, there is an element of exploration as to what can be achieved using libraries of code that other programmers have written. In Python these libraries are called ‘packages’. When considering a specific problem, it may be worth trying a few different packages to see what works. Try and find packages without looking at the Hints and Tips first! (It is worth noting, though, that all challenges will use the standard numpy and matplotlib packages.)

Getting Help

There are several different ways of getting help if you get stuck. The help(), dir() and type() commands within Python are often helpful for debugging. Most packages have good online documentation, accessed using any search engine, which may give example usage. Finding existing code may show you alternative methods of using a particular package, and help improve your programming abilities (for example, on the repository website Github).