Coding
Coding

Variables, Loops & Conditionals

Learn the three core building blocks of programming — variables, loops, and conditionals — and use them to write your first Python programs.

Grade 6-8Beginner50 min75 pts

About This Lesson

Every program ever written — from Instagram to NASA's Mars rover — uses just three core ideas: storing information, repeating actions, and making decisions. In this lesson, you'll learn all three and write your first real Python programs.

Essential Question

Think of a vending machine. What decisions does it make? What does it remember? What does it repeat?

Standards

CSTA 2-AP-11, 2-AP-12, 2-AP-13

Learning Objectives

  • 1Define variables and explain how they store and change data in a program
  • 2Use for and while loops to repeat code efficiently
  • 3Write if/elif/else conditionals to make programs respond to different inputs

Materials Needed

  • Chromebook with Replit or Google Colab
  • Python Cheat Sheet handout

Key Topics

Pythonvariablesloopsconditionalsprogramming basics