Featured resource
2026 Tech Forecast
2026 Tech Forecast

1,500+ tech insiders, business leaders, and Pluralsight Authors share their predictions on what’s shifting fastest and how to stay ahead.

Download the forecast
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Core Tech
Labs

Interactive Directory in Python

Build a Python command-line campus support directory that stores service information in a dictionary, lists available services, and lets a user safely look up details.

Lab platform
Lab Info
Level
Beginner
Last updated
Jun 11, 2026
Duration
45m

Contact sales

By clicking submit, you agree to our Privacy Policy and Terms of Use, and consent to receive marketing emails from Pluralsight.
Table of Contents
  1. Challenge

    Step 1: Get oriented with the project

    In this project you will build a small Python command-line application that stores campus service information in a dictionary and helps a user find the right location and hours. The starter project is organized into focused modules: app/directory_data.py holds the dictionary helpers, app/display.py handles prompts and menu formatting, app/lookup.py coordinates safe lookups, and app/main.py runs the interactive loop. The tests folder contains one pytest file per step, and runTest.sh lets you run a single task test by name.

  2. Challenge

    Step 2: Build the dictionary-based data layer

    Before a user can search for anything, the program needs an in-memory representation of available services. In this step you will create the starter dictionary, add a helper to update it, and produce a sorted list of service names for the menu.

  3. Challenge

    Step 3: Prepare and present user input

    Users may type extra spaces or inconsistent capitalization, so input needs to be normalized before a dictionary lookup. In this step you will clean user input, wrap it in a prompt function, and format the available services into a numbered menu.

  4. Challenge

    Step 4: Implement safe lookup behavior

    Now you will connect the data and display layers into an actual lookup flow. The focus is safe dictionary access — using dict.get to avoid crashes on missing keys — and clear result messages for both found and missing services.

  5. Challenge

    Step 5: Polish the interactive flow

    The lookup flow works for a single request. Now add loop control so the user can search again, and a closing summary that reports the directory size.

  6. Challenge

    Step 6: Run the finished application

    All the pieces are in place. In the terminal, run:

    python -m app.main
    

    When the menu appears, type a service name and press Enter. Try a service that exists and one that does not. When you are done searching, enter anything other than y or yes to exit and see the closing summary.

About the author

Tom is a staff author at Pluralsight helping to develop Hands-On content. Tom's background in software development, UI/UX, and instructional design was developed over the years while working as a faculty member at the School of Computing at Weber State University in Utah, and continues to grow as he develops Projects and Labs for Pluralsight. When he's not creating content to allow learners to gain real-life experience, he enjoys spending time with his family.

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.

Get started with Pluralsight