Skip to main content

Unit Plan: Exploring Our Universe with Python and Algorithms

Unit Overview

This unit will introduce middle school students to basic Python programming concepts while exploring space science themes. The unit will culminate in a final project where students create a simple space-themed game or simulation using Pygame.

Lesson 1: Introduction to Python Basics and Algorithmic Thinking

Objectives:

  • Understand basic Python programming concepts: variables, data types, and basic algorithms.
  • Apply algorithmic thinking to solve simple problems related to space science.

Activities:

Lecture & Discussion:

  • Briefly introduce Python and its relevance to space science.
  • Explain variables and data types using examples related to celestial objects.
  • Example code to calculate the distance from Earth to other planets.

Hands-On Activity:

  • Students write Python scripts to calculate and print distances of planets from the Sun.
  • Worksheet with practice problems.

Lesson 2: Input/Output and Conditional Logic

Objectives:

  • Learn to use input and output functions in Python.
  • Understand and apply conditional statements to make decisions in code.

Activities:

Lecture & Discussion:

  • Introduce input() and print() functions.
  • Explain conditional statements (if, elif, else) using space science examples.
  • Example code to determine if a planet is habitable based on certain conditions.

Hands-On Activity:

  • Students create a program that asks for user input about a planet's characteristics and provides feedback.
  • Worksheet with practice problems.

Lesson 3: Loops

Objectives:

  • Understand and use loops in Python to perform repetitive tasks.

Activities:

Lecture & Discussion:

  • Introduce for and while loops.
  • Use loops to simulate repetitive space phenomena (e.g., orbital periods).

Hands-On Activity:

  • Students write programs that simulate the orbits of planets using loops.
  • Worksheet with loop exercises.

Lesson 4: Introduction to Pygame

Objectives:

  • Set up a Pygame window and create simple visualizations.

Activities:

Lecture & Discussion:

  • Introduce Pygame and its use in creating visual simulations.
  • Basic setup of a Pygame window and drawing simple shapes.

Hands-On Activity:

  • Students create a Pygame window and draw a representation of the solar system.
  • Worksheet on setting up Pygame and handling basic events.

Lesson 5: Advanced Project Development Concepts

Objectives:

  • Learn to create and manage game objects using classes.
  • Implement basic interaction detection and scoring.

Activities:

Lecture & Discussion:

  • Explain how to use classes in Python to create game objects.
  • Demonstrate basic interaction detection (e.g., collisions) and scoring mechanisms.

Hands-On Activity:

  • Students expand their Pygame project to include interactive elements and scoring.
  • Quiz on specific code given

Lesson 6: Setting up your game

Objectives:

  • Create a space-themed game where the player navigates a spaceship to collect items and avoid obstacles.

Activities: 

  • Walk students through building a simple space game in Pygame

Resources:

Rubric and Final Game Code

CodeHS

**more to come

 

Lesson Plan for Middle School Computer Science
Prepared by Jessica Brewer, K12 Outreach Coordinator, Purdue CS

Purdue University College of Science, 475 Stadium Mall Drive, West Lafayette, IN 47907 • Phone: (765) 494-1729, Fax: (765) 494-1736

Purdue University Indianapolis, 723 W. Michigan St., Indianapolis, IN 46202

Student Advising Office: (765) 494-1771, Fax: (765) 496-3015 • Science IT: (765) 494-4488

© 2024 Purdue University | An equal access/equal opportunity university | Copyright Complaints | DOE Degree Scorecards

Trouble with this page? Accessibility issues? Please contact the College of Science.