PY-1.4-BP4-MQ20

Objective

Welcome to Structure for Success: Organize Your Project!

Your objective in this micro-quest is to reorganize your project files into a deployment-ready structure. You will create a root folder for the project, place your main Python script inside it, and create a sub-folder named assets to hold any images or sound files.

Check Specification

Before we start implementing, let's check the current state using the provided verification script (test_structure.py).

This script attempts to run your create_structure.py and verifies if the expected folders (my_pygame_project and my_pygame_project/assets) are created.

Run the verification script now. You should see output indicating that the required folders were not found, as you haven't created the structure yet.

Verification Results:

  • Tests that running the solution script creates the correct directory structure (root folder and assets sub-folder) within a temporary directory.

Implement: `create_structure.py`

Now, let's implement the code in create_structure.py to create the required project structure.

Step by step checklist:

  1. Import the necessary Python module for interacting with the operating system.
  2. Define string variables to hold the names for the project's root folder and the assets sub-folder.
  3. Define a function that will contain the logic for creating the directories.
  4. Inside the function, use the imported module to create the root project directory. Ensure the function does not raise an error if the directory already exists.
  5. Inside the function, use the imported module to create the assets sub-directory inside the root project directory. Ensure this also does not raise an error if it already exists.
  6. Add the standard Python entry point check (if __name__ == "__main__":).
  7. Inside the entry point block, call the function you defined to create the structure.

The following documentation sections are going to be helpful:

  • Project Structure for Web Export

Validate

You've implemented the code to create the project structure. Let's run the verification script (test_structure.py) again to ensure it now passes.

If your script correctly creates the my_pygame_project folder and the assets sub-folder inside it when executed, the verification script should now report success.

Run the verification script now.

Verification Results:

  • Tests that running the solution script creates the correct directory structure (root folder and assets sub-folder) within a temporary directory. All verification steps passed!

Documentation

Documentation not available for PY-1.4-BP4.