Skip to main content

Object-Oriented Programming Activity: Python Digital Pets Game

Downloaded: 3861

Last edit: 21 February 2025

Resource Type Teaching Resources, Example Programs and Live Lessons
Curriculum Topic Algorithmic Thinking, Computational Thinking, Programming
English Key Stage 16-18 Years (KS5)

A Python translation of Austin Henley's original Java homework task, shared with permission and with thanks to the original author. 

Skeleton Python code is provided that runs a basic digital pets game with actions such as Eat and Exercise. Tasks are provided that require students to extend the game by adding more pet species, more actions, and editing the main() program code, using key principles of object-oriented programming, including: 

  • changing attribute access modifiers (name mangling)
  • implementing and using a constructor method
  • implementing and using getters and setters
  • using inheritance to create subclasses
  • abstract methods
  • static methods
  • linking objects through association (composition)

Code is commented and the tasks are embedded in the comments.

I am currently not providing Task 2 answer code publicly as this is an assessed homework but can send via email upon request.