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

Chapter 1: Introduction

Recap

face Josiah Wang

Welcome back!

Now, let us recap what you have learnt to date.

Remember that we started off from the very beginning. You learnt all the basics of programming, and hopefully remember to always understand and think about the problem first before starting to code! You also learnt how to write reusable and highly abstracted code via functions.

You also explored more complicated data structures provided by Python: lists, range, tuples, str, dict, and in the previous lesson, sets.

Set operations

We then started moving towards a more object-oriented style of programming. You wrote your own custom classes with attributes and methods. You have used constructors (__init__()) to initialise attribute values etc. Python also offers magic methods that you can implement to do special things with your custom classes. Hopefully you have started appreciating the power of object-oriented style of structuring programs!

Class diagram for car

We also discussed what Python modules actually are, and how you can structure your scripts easily by dividing them into modules.

You also looked at how to read and write to files.

You have also learnt of two possible paradigms to validating your inputs, contrasting Look Before You Leap (LBYL) and Easier to Ask for Forgiveness than for Permission (EAFP). Python recommends the EAFP approach.

You have refactored your robot project yet again, this time making it more object-oriented by converting the dict representation into a custom Robot class with attributes. You later also added some methods to present your robot’s actions.

We have also wrapped up our tutorials on Git, by putting your robot project on a remote repository, and git push any local commits to the remote repository. Hopefully this will be enough of an introduction for you to further explore the world of Git !