A class can be thought of as a way of assigning a name to a set of specific functions and variables that are all associated with a common piece of an application.
The code for a class differs in two main ways from regular Python code.
Firstly, you will see the class keyword before the name of the class, followed by a colon and an indented scope. This is the syntax for telling Python that everything within this scope belongs to the class.
Secondly, all functions defined will have self as their first argument (unless they are static or class methods). This is automatically passed in via Python itself and so will cause calls to the function to appear to need one fewer argument than the definition.
The purpose of the self argument is to give each function (which, when in the scope of a class, is known as a method instead) access to the instance's other...