In this week’s Understanding Code – Python seminar the use of classes were explored. Whilst this felt quite a step up from last week’s topics on variables, for, if and while loops, we were reassured that Phil Jeffes, the seminar presenter, had been studying his undergraduate for two years before classes were introduced.
The examples started with basic implementation of classes; how they are defined and can then have functions called upon them. Towards the end of the seminar, a more complex example was given. Participants were given some code which, when completed, would allow them to move between different rooms of a house depending on the user’s input. To complete the code an if statement was required to determine the user’s input and to catch if the number of inputs exceeded the number of variables in the list.
The Understanding Code series comes to an end next Monday (07th March) where everything taught up to date will be used to link python code to a web browser.