← Course home Next: Python sensors → Code clears when you leave
MISSION 06 · PYTHON BASICS

How Many Packages?

Follow one named variable as packages arrive and leave. Predict both counts, read the trace, and explain how an update works.

What’s saved: your code, predictions and answers clear when you leave this page or reload. If you turn saving on, only which puzzles you finished and how much help you used is kept on this device. Test accounts also share it, and lesson timing, with the site’s maintainer.

◇ Your mastery goalPython package variables

Complete all 3 required tasks with a correct prediction, an inspected trace and an explanation that shows the concept. At least 2 must be independent checks, without answer-level help.

✓ Qualifying tasks: 0 / 3◎ Independent checks: 0 / 2 required
PRACTICE · 1 OF 3

Sorter shift

0 / 3 checks

The sorter begins with a small stack, receives new parcels, then sends some out. Follow the count as the label machine updates it.

1
Read the starting countsThese named values are read-only inputs for your program.
2
Predict before RunWhat is packages after the first assignment? What number will print?
3
Write the package updatesOnly the packages variable can be assigned.

Allowed: packages = 0, packages = start, + - ( ), print(packages), comments and blank lines.

Use whole-number literals 0–99 or the named inputs. Store an initial value, then make a meaningful update using the current packages value; print once at the end. Equivalent short programs can work. Calculations stay between -999 and 999. This is a small Python subset.

5
Explain the updateWhen an assignment uses packages on the right, which value is read?
Choose the explanation that fits
Help for this package puzzleHints build in steps. Worked help needs a deliberate choice.

Highest help used on this case in this session: none

For Further Reading and Exploration

These are outside sites with their own rules. You will see a notice before you leave. Pick one, not all.

  • Automate the Boring Stuff with Python

    Free book to read online. Its early chapters explain variables, and how values get stored and changed.

    • Hands-on
    • May need an install
    • Ask an adult
  • CS50's Introduction to Programming with Python

    Free Harvard course with videos and notes. The first lecture covers variables and how a program keeps values.

    • Hands-on
    • Advanced
    • May count visits
  • Raspberry Pi Foundation Projects

    Step-by-step Python projects. Pick one that stores a score or a count, then change the numbers. Some need hardware.

    • Hands-on
    • May count visits
  • MIT OpenCourseWare 6.100L

    Free college course notes and videos. It moves fast, so take one topic at a time. Look for the early lectures on variables and values.

    • Hands-on
    • Advanced
    • May count visits