Skip Navigation

Magic 8 Ball

By Brooke Snow 90 minutes
Grade 7-8
  • Programming
  • Data
  • Design
Tools & Languages,

Key Coding Concepts

  • Algorithms
  • Functions
  • Random Numbers



A bundle of code that a programmer can use to perform tasks.



A set of instructions in our code that can be repeated over and over again. We call the function to execute the instructions inside.



A set of values (x, y) that represent a position on the screen. X values represent a horizontal location, Y values represent a vertical location.



Stores some information we may want to use again. Ie: a list of possible answers.


RBG Colours

Colours represented in terms of how much red, green and blue are present. Ie: (R, G, B) where R, G & B are values from 0 – 255 inclusive.

Learn how to use Python and to simulate an interactive Magic 8 Ball. A simple introduction to Python and programming, with a fun result!

  • Familiarize yourself with Trinket
  • Go through the tutorial yourself
  • Talk with the class about how a Magic 8 Ball works and produces random answers from a finite set of possible answers
  • Optionally, learners can log into Trinket using their Google, Clever or Edmodo accounts to save and access their programs easily
  • Introduce Trinket to the class as in the video above

Lesson available here.

Determine how you will access learners' work in Trinket. Some options are: Sign up for Trinket Connect, have learners email links to their work or gather links in Google Docs.

Design: Learners can ‘re-design’ and personalize the Magic 8 Ball. Try changing the possible answers, changing the colours and size of the Magic 8 Ball or try to make an answer print by pressing a key on the keyboard instead of with a click.

Teach lessons that are tied to your existing curriculum!


More Lesson Plans For Grade 7-8

    View All Lesson Plans

    Explore lessons based on components

    The K-12 Computer Science Framework

    Although learning how to build digital projects is a key part of Computer Science education, students should also learn a wider set of skills and competencies that will help them to harness the power of digital technologies as both creators and consumers. A comprehensive approach to K-12 Computer Science education includes learning about the following five focus areas:

    View Framework ➝


    By the end of high school, students should be able to create a simple computer program.

    Computing and Networks

    By the end of high school, students should understand and be able to use the tools and devices commonly used to build digital projects.


    By the end of high school, students should be able to explain how we use computers to create, store, organize, and analyze data.

    Technology and Society

    By the end of high school, students should be able to explore the ways in which technology and society have mutually shaped each other.


    By the end of high school, students should be able to apply design principles to the digital projects they create.