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

Conditionals in Python

Build a small Python CLI for an indoor adventure park front desk. You will implement comparison helpers, simple conditional message builders, and multi-branch decision functions, then combine them into a complete visit summary for sample guests.

Lab platform
Lab Info
Level
Beginner
Last updated
May 07, 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: Explore the starter project

    You are building a small Python CLI for an indoor adventure park check-in desk. Starting from a set of placeholder functions, you will implement comparison helpers, conditional message builders, and multi-branch decision functions — then combine them into a complete visit summary for sample guests.

    The project is split into focused modules: app/comparisons.py holds boolean helpers, app/messages.py builds optional summary lines, app/classification.py handles multi-branch logic, app/report.py combines the results, and app/main.py prints the output.

    If you need assistance, solutions for each task can be found in the solutions directory.

    info > This lab experience was developed by the Pluralsight team using Forge, an internally developed AI tool utilizing Gemini technology. All sections were verified by human experts for accuracy prior to publication. For issue reporting, please contact us.

  2. Challenge

    Step 2: Create reusable comparison helpers

    Boolean helper functions wrap a single comparison and return True or False, giving business rules a readable name and making them easy to test. In this step, you implement three helpers in app/comparisons.py — each returning a comparison result directly.

    You will:

    • Implement an equality comparison (==)
    • Add a minimum-height check with an inclusive operator (>=)
    • Detect when a credit balance falls below a required amount (<)
  3. Challenge

    Step 3: Add optional messages with simple if statements

    A simple if block runs its indented code only when the condition is true. When the condition is false, Python skips the block and continues — so the base output is always produced. In this step, you use if statements to append optional lines to a guest summary in app/messages.py.

    You will:

    • Add a membership bonus line for members only
    • Show a prize counter message when credits exceed a threshold
    • Append an equipment rental note when stock is available
  4. Challenge

    Step 4: Build multi-branch classifications

    When a program must select exactly one result from several categories, an if/elif/else chain evaluates conditions in order and runs only the first matching branch. Branch order and boundary operators determine which category each input receives. In this step, you implement three classifiers in app/classification.py.

    You will:

    • Classify guests into climbing zones by height
    • Assign ticket bands by age range
    • Report locker availability across three distinct states
  5. Challenge

    Step 5: Integrate the helpers into a working CLI

    app/report.py imports the helpers from earlier steps and assembles their output into a single multi-line summary. app/main.py loops through sample guests and prints each summary. In this step, you complete both files to produce a working end-to-end CLI.

    You will:

    • Combine all helpers into a single visit summary function
    • Loop through sample guests and print formatted output with separators between them
About the author

Pluralsight’s AI authoring technology is designed to accelerate the creation of hands-on, technical learning experiences. Serving as a first-pass content generator, it produces structured lab drafts aligned to learning objectives defined by Pluralsight’s Curriculum team. Each lab is then enhanced by our Content team, who configure the environments, refine instructions, and conduct rigorous technical and quality reviews. The result is a collaboration between artificial intelligence and human expertise, where AI supports scale and efficiency, and Pluralsight experts ensure accuracy, relevance, and instructional quality, helping learners build practical skills with confidence.

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