This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 1: Introduction

Introduction

face Josiah Wang

Hopefully that quiz was easy! Make sure you understand everything before moving on!

In previous lessons, we focussed on the basic building blocks of structured programming: simple (sequential) statements, selection, repetition. These building blocks are common in most imperative programming languages, so you should be able to apply most of what you have learnt so far to design your algorithms and implement them in different programming languages to solve programming problems.

From this lesson onwards, I will focus on providing you with even more programming tools to help you write programs more efficiently. While most of these are common in most modern programming languages, some are specific to Python.

So far, you have been writing simple programs as a single big sequence of code blocks.

In this lesson, the main focus will be on writing self-explanatory and reusable code, by breaking your program into smaller, reusable chunks with semantic names. This style of writing code will allow you to design algorithms at a higher level, and also help produce code that is easier to read and maintain. This becomes more important as you start writing larger programs. We will start pushing you to write this kind of code from this lesson onwards.

We will also cover other topics as usual - some more Python features, good software engineering and programming practices, debugging, and a heavy duty git topic (branching).

Finally, you will be restructuring your code for your robot project into reusable, self-explanatory chunks. This will probably be the biggest and most time-consuming and energy-consuming task you will be doing in this lesson! Stick with it, and hopefully by the end, you will be able to naturally write beautifully structured, organised, self-explanatory, and reusable code! And hopefully you will not want to go back to writing a single big chunk of ugly code!

Let us begin. As usual, engage actively in all activities, and take a break between chapters (or at any point) if needed.