Introduction

The aim of these lessons is to provide you with a foundational knowledge of programming and Python and an understanding of the use such technologies in psychology applications—and the capacity to implement such technologies yourself.

What is programming and what is Python?

A program is a set of instructions for a computer to perform a particular set of tasks—programming is the process of developing these instructions. Here, we will be using a programming language called Python—a language that is very readable and quick to get up-and-running for new users. It is one of the most popular languages for computer programming, and is currently the most frequently taught language for introductory computer science students in the USA.

Python is far from just a language that is useful for education, however. It is used to run some of the most popular websites in the world, such as YouTube, Reddit, and Google Maps. It also has extensive roots in the scientific community, with comprehensive Python frameworks available for many disciplines.

Why is programming useful to learn as a psychology student?

The main benefits of learning programming as a psychology student stem from its usefulness in conducting research and how it can develop cognitive skills:

  • It allows greater flexibility and independence in research.
    Much of research involves doing something that has never been done before. Knowing a programming language such as Python gives you the power to use your computer in ways that go far beyond what can be offered by any general or specialist application.
  • It promotes sound research practices.
    Your code becomes an accurate record of precisely what was involved in your research. Anybody with access to your code can have a clear understanding of what it was that you did in your research.
  • It develops algorithmic and problem-solving abilities.
    Successfully programming a solution to a particular task requires an algorithmic approach and a problem-solving mindset. Furthermore, as you will see, programming is very unforgiving of mistakes or imprecision—hunting down the cause of coding errors (‘bugs’) is in itself an excellent way of honing problem-solving skills and strategies.

To hear more about my rationale for teaching programming in psychology, you can watch a presentation I gave at PyCon Australia in 2016.

How are these lessons organised?

Each lesson is focused around a key concept in the fundamentals of Python programming. The recommended approach is to follow along with the content while writing and executing the associated code.

What should I do if I get stuck on an error message?

You will notice that there is another page called Dealing with errors. If you are encountering an error that you are having trouble understanding, feel free to jump to this content and see if you can get more information on its cause and possible remedy.