- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Core Tech
Nested Data and JSON in Python
Complete a Python starter project for a city trip planner using nested lists, dictionaries, and JSON serialization.
Lab Info
Table of Contents
-
Challenge
Step 1: Explore the City Explorer Planner starter project
Welcome to the City Explorer Planner lab. You will complete a small Python utility that stores trip ideas, place categories, traveler records, and a final exportable snapshot.
The
plannerpackage is split by responsibility:itinerary.pyworks with nested lists,categories.pyuses dictionaries with list values,profiles.pymodels travelers as dictionaries, andsnapshot.pycombines everything and serializes it with thejsonmodule. Thetestsdirectory has one pytest file per task, andmain.pyis an entry point you can run manually. >If you get stuck, you can refer to the provided solution code for each task, available in thesolutionfolder.info> This lab experience was developed by the Pluralsight team using an internally developed AI tool. All sections were verified by human experts for accuracy prior to publications. However, content may still contain errors or inaccuracies, and we recommend independent verification. To report a problem or provide feedback, click here. Feedback may be used to improve accuracy in accordance with our Privacy Policy.
-
Challenge
Step 2: Build and navigate the nested itinerary
In this step you will group activity lists into a nested structure, retrieve a specific value by index, and flatten the whole collection for reporting. All three tasks live in
planner/itinerary.py. -
Challenge
Step 3: Organize place recommendations by category
In this step you will store lists of place names inside a dictionary, format its contents by iterating with
items(), and add a safe case-insensitive lookup. All three tasks live inplanner/categories.py. -
Challenge
Step 4: Model travelers with dictionaries
In this step you will represent travelers as dictionaries, generate readable summaries from their fields, and map that formatting over a list of profiles. All three tasks live in
planner/profiles.py. -
Challenge
Step 5: Create the final snapshot and export it
In this final step you will combine all planner data into one snapshot dictionary, serialize it as JSON, and compute totals from the nested structures. All three tasks live in
planner/snapshot.py. -
Challenge
Step 6: Run the planner
All functions are complete. In the terminal, run:
python main.pyYou should see the itinerary, category map, traveler summaries, JSON snapshot, and totals printed with no errors. Congratulations on completing the lab! In this project, you built a city trip planner that outputs a nested itinerary, formatted category listings, traveler summaries, and a serialized JSON snapshot, all printed cleanly from a single
main.pyentry point. Along the way, you practiced working with nested lists and dictionaries, safe index lookups, dictionary iteration withitems(), and list manipulation usingextend(). You also modeled real-world data as Python dictionaries, transformed collections of records into readable summaries, and usedjson.dumpsto serialize a complex nested structure into a portable, deterministic JSON string.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.