talk-data.com talk-data.com

Event

Python Foundation Course (Session 1 of 6)

2025-06-02 – 2025-06-02 Meetup Visit website ↗

Activities tracked

0

Update: If you would like a head start, this YouTube video is a 10 minute demo of what we'll be doing in this lesson.

This is a hands-on tutorial-style foundation course in Python course over six Monday evenings. It is suitable for beginners and people who have not coded before. Over the six weeks, we design and code the snake game step by step. This is an online (on Teams) course.

The best way to learn Python is to write a classic game such as snake. This may seem a frivolous exercise compared to a more serious use case of, for example, data analysis. However, writing a game like this one forces us almost immediately to use many of the features of the language. We hope this will more fun and interesting than a more traditional approach, and more relevant especially to people who have not coded before.

In the course, we start by creating variables and constants to set up our screen and snake. We implement our snake firstly as a single square then later as a Python data structure (a list of tuples). We use list methods, such as append and pop, to create our snake. To keep our code organised and readable, we create a Snake class so that our snake can move and eat. We use looping, (with the for and while keywords) so that the snake responds to our key presses and conditional flow (with the if keyword) so that it eats and grows when it finds food. We learn how to install and import packages such as the pygame package that provides the basic 2D game functionality.

This is the first time we have run this course - expect a few bumps along the way.

The provisional timetable looks like this

2nd June: Session 1 - Setup Install Python and the VSCode editor on a laptop, then create a Python environment, install some packages and write/run a tiny script to prove everything is set up properly.

9th June: Session 2 - our snake responds to user input We'll review the code in Session 1. This sets up our game and our snake is only a single square and does not move yet. We get our snake to change colours and to move up / down / left / right a single square when the user presses the arrow keys on the keyboard.

This covers these Python topics: the while and for loops, invoking functions, the basic structure of a Python program.

16th June: Session 3 - move like a snake We get our snake to change colours and to move more like a snake e.g. the snake moves at a constant speed, and the arrow keys control the direction but does not allow reversing.

This covers these Python topics: the if-elif-else code block, tuples, data types

23rd June: Session 4 - from a square to a snake Our snake literally takes shape and behaves more like the classic snake in the game. The game stops if the snake moves off the screen.

This covers these Python topics: lists, dictionaries, writing functions.

2nd July: Session 5 - our snake eats and grows Note: this is on a Wednesday rather than Monday The snake eats food and grows when it does.

This covers these Python topics: introduction to classes and object oriented programming.

7th July: Session 6 - applying the rules The game ends when the snake leaves the screen or collides with itself. If time allows we may implement a score.

This covers these Python topics: more about classes, organising code into modules

Sessions & talks

Showing 1–0 of 0 · Newest first

Search within this event →

No individual activities are attached to this event yet.