Category Archives: python

Learning to code with Python

I gave yesterday an introductory workshop on coding within the Digital Day of Ideas organised by Digital Scholarship here at the University of Edinburgh. I thought this could be interesting for a wider audience so I published it online. It is designed to present the basic concepts of any programming language in roughly 2 hours to an audience of the Social Sciences and Humanities that never ever coded before.

This is the list of topics covered by the tutorial:

  • understand the basic concepts of a programming language
  • repeat tasks with loops
  • structure your code with functions
  • add some logic to your code
  • open text files
  • plot stuff

The tutorial has 2 blocks; in the first one you will see the basic ideas and in the second one you will apply them in a specific task: identify the most frequent words used in a book.

The tutorial and the dataset can be downloaded from github or if you prefer as a zip file. You will need a development environment where to type and execute the source code, so you can use the spyder IDE within Anaconda:

  1. Go to
  2. Choose a Python 3.6 windows, linux or osx installer depending on your system – Attention: please make sure you install python 3.6 and not python 2.7.
  3. Follow the installation instructions
  4. Launch Spyder from the Anaconda Navigator.

You are now ready to start coding!