Skip to main content

Object-Oriented Programming Activity: Python Digital Pets Game

Downloaded: 1678

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. 

 

Edit history

Nela Brockington | 21.02.25

Included answers as text file.

Nela Brockington | 21.02.25

Re-uploaded the resource questions and answers to Task 1 as text files instead of .py files.

Nela Brockington | 21.02.25

Re-uploaded resource as text file instead of .py file.

Nela Brockington | 10.01.24

Allow commenting.

Nela Brockington | 20.04.22

Fixed typo in description.

Nela Brockington | 20.04.22

Minor edit to activity description.

Nela Brockington | 20.04.22

Minor edit to activity description.

Nela Brockington | 20.04.22

Added answer code for Task 1 A, B, C.

Nela Brockington | 20.04.22

Minor edits to activity description.

Nela Brockington | 20.04.22

Minor edit to title and description.

Nela Brockington | 20.04.22

Initial creation

Discuss: Object-Oriented Programming Activity: Python Digital Pets Game (2022-04-20)

Please login to post a comment

Nela Brockington
21/02/2025 21:30

P.S. I re-uploaded the resources as text files instead of .py files, downloaded them, and was able to open the .zip file. So this should work now.

@BecciPeters, the issue is with downloading .py files specifically. I was using Safari on a MacBook Pro.

Nela Brockington
21/02/2025 21:19

@Philippa Lewty I also tried to download the file and it was empty. However the .py code files are uploaded, so I hope CAS moderators can work out what is going wrong. Meanwhile, you are welcome to email me for the resources on my profile address.

Becci Peters
30/01/2025 09:16

Thanks for flagging. We’ll look into it!

Philippa Lewty
29/01/2025 16:12

Currently the compressed file is empty when you download it - is this correct?

Unlock