Home | Prices | Contact Us | Courses: Power BI - Excel - Python - SQL - Generative AI - Visualising Data - Analysing Data
Python Snake Course Lesson 5 - Classes
Back to Python Snake Course Landing Page
Lesson 5 focuses on implementing our snake as a class. We use the Python code at the end of lesson 4 as a starting point.
This is the agenda:
- a recap and explanation of the current code (as a reminder and a brief introduction for anybody joining the course for the first time)
- a brief look at unpacking a list (or tuple) and list comprehensions. We will need both of these later in this lesson
- an example of a very minimal implementation of a class, and then a more complete example that follows best practices
- create our Snake class
- refactor some of our functions so that they become methods of the Snake class
- and refactor other functions so that we pass a variable representing an instance of the Snake class as an argument