Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Cloning and Modifying Mutable Objects in Python

The nature of how Python handles mutable and immutable data can make it easy to accidentally modify a different variable when passing mutable data structures into functions or methods as arguments. Being able to use a dictionary or list a variable's contents without changing the original can be very handy for creating a default configuration, or as a data template. In this hands-on lab, you'll be writing a small script that utilizes a data template to help generate information about a real estate transaction while ensuring that the original data isn't modified during the process. Completing this lab will demonstrate that you understand how data copying works within Python.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 13, 2025
Duration
1h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Parse the Template JSON File

    There should always be a template.json file next to the script so that it can get an up-to-date picture of the values that don't change. When the script is initially run, this should be parsed and stored as the template variable.

  2. Challenge

    Prompt for the Values That Need to Be Changed

    When the tool is run, it should present the user with a series of prompts like this:

    $ python real_estate.py
    Address
    Street 1: [prompt]
    Street 2: [prompt]
    City: [prompt]
    State: [prompt]
    ZIP: [prompt]
    
    Details
    Square Footage: [prompt]
    Bedrooms: [prompt]
    Bathrooms: [prompt]
    Amenities (use | between items): [prompt]
    
    Was there a referrer? (Y or n): [prompt]
    Referrer: [prompt ONLY if Y to previous]
    
  3. Challenge

    Export New Data to a New JSON File

    Write the dictionary with the new values to a JSON file named after the street address of the property with the spaces converted to dashes.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

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