Motivation and Background#

Learning Objectives#

In this lesson, we will discuss:

  • Who you are, and why you signed up for this course

  • Why you should learn to code

  • Why Python is great!

Who are you?#

As we begin, and ensure that everyone has a working Python installation, feel free to write in the Teams chat which Department you are from, and any reasons you signed up for this course!

Why learn to code?#

Loads of reasons! Focused on researchers specifically:

  • Code allows you to analyse large (millions of rows) data sets.

  • Scripts, programs and software are explicit lists of instructions. Hence, analysis performed via code makes this analysis more reproducible, replicable, and robust.

  • Code allows you to share your analysis with others. It becomes easier to integrate into other systems built with code, such as websites, blogs, dashboards, and other pieces of software.

  • Code can help create complex visualisations, nicely formatted documents, animations, and other engaging outputs.

  • Code can speed up repetitive tasks such as editing or renaming files, copying data, and even collecting new data.

  • Code can help manage multi-user projects, ensuring research is not lost when individuals move on.

  • Being fluent in even one coding language can open up many career opportunities.

But most importantly:

  • It is fun, and also incredibly satisfying, to build things!

Why Python?#

  • Python is open-source. Code written with Python is freely usable and distributable, even for commercial use.

  • Python is easy to learn, compared to other programming languages. Its syntax was specifically designed to be easily read and understood, even by amateur developers.

  • The Python community is large, and community support is easy to find. If you have a problem, someone has probably had the same problem before you!

  • Python is a general purpose, flexible, versatile language. It can be used for data analysis, building websites, designing software, and anything else you can think of.

  • If you want explore machine learning, AI, NLP, and similar, most of the cutting edge systems are built with Python.

  • Python is supported by some huge organisations, such as Amazon, Google, and Facebook.

Why Python over X?#

Q: MATLAB and R are commonly used in academic settings. Why should I use Python over these?

A: There is no right answer, and everyone has their own opinion! At the end of the day, most modern languages are Turing complete, and can solve a variety of problems. However, Python is more popular than both of these languages outside of academia, it has a larger worldwide community, and is the de-facto language for machine learning and AI applications.

Some more details are found below:

  • MATLAB is not open-source, and toolboxes are incredibly expensive. If you plan on ever leaving academia and programming for yourself, or for your own company, you should not learn MATLAB (as you will have to pay huge amounts to avoid wasting your language-specific knowledge). In addition, outside of engineering, MATLAB is less commonly used. MATLAB does have some good features: matrix manipulation in MATLAB is well considered, and Simulink is effective as well. For everything else however, consider another language: Python is an obvious choice.

  • R is an open-source statistical computing language, with some excellent features for statistics and visualisation, including some fantastic Bayesian and MCMC packages. However, if you plan on linking analysis with cloud services, building websites or applications, or performing other development tasks, a general purpose language such as Python is perhaps a better choice. A good comparison of Python and R is made by IBM here.

Why NOT Python?#

Q: What are the reasons I should not learn Python?

A: As a beginner, there are none to worry about for a few years! However, compared to languages such as C++ or Rust, Python can be slower (in terms of calculation speed) for certain types of tasks. In addition, if you plan on building web applications, or anything with a front (user-facing) end, you will have to learn Javascript at some point. Even so, Python is a fantastic choice for your first (general) programming language.

Summary Quiz#