...

Chapter 11 - Python Quest

Data Records

Mix lists and dictionaries into the bigger shapes real programs use.

XP
0Level 1
Stars
0/12quest stars
Combo
0clean runs
Rank
Seed0/160 Python score
Dictionaries of lists

Backpack Total

100 XP

A field trip helper sorts a backpack into snack, school, and treasure pockets.

Write backpack_total(backpack) so it returns how many items are packed across every category.

Sample checks

backpack_total({"snacks":["apple","crackers"],"school":["pencil"],"treasures":[]})returns3

Explanation: two snacks and one school item

backpack_total({"snacks":["cookie"],"tools":["map","compass"],"treasures":["rock","shell"]})returns5

Explanation: several full pockets

Hint

Hints are ready when you want one.

Lesson reference

Review: Dictionary values can be lists

Your Python

backpack_total

Loading editor

Judge

Ready

0/4

Run your code when it feels ready.