Create a projects folder
Before we start coding, let’s create a dedicated place for all your Python projects.Having one folder for all your projects keeps your computer organized and makes it easy to find your code later.
-
Create a main folder for all your Python work:
- Windows: Create a folder called
PythonProjectsin your Documents - macOS: Create a folder called
PythonProjectsin your home directory - Linux: Create a folder called
PythonProjectsin your home directory
- Windows: Create a folder called
-
Create your first project folder:
- Inside your PythonProjects folder, create a new folder called
python-for-ai(all lowercase) - This will be our learning project for this course
- Inside your PythonProjects folder, create a new folder called
You can name your project folder anything you like, but I usually use lowercase letters with dashes (called “kebab-case”) like
python-for-ai or my-first-project. This matches how projects appear on GitHub (more on that later).Open folder in VS Code
Now let’s open this folder in VS Code. There are several ways: Method 1: From VS Code- Open VS Code
- Click “File” > “Open Folder” (or press
Ctrl/Cmd + O) - Navigate to your
python-for-aifolder - Click “Select Folder” (Windows) or “Open” (Mac/Linux)
- Windows: Right-click the folder > “Open with Code”
- macOS: Drag the folder onto the VS Code icon
- Linux: Right-click the folder > “Open with Code”
Understanding the interface
When you open a folder in VS Code:- Left sidebar: Shows all files in your project (currently empty)
- Main area: Where you’ll write code
- Bottom panel: Terminal, problems, output
- Top: Menu and tabs for open files
VS Code always works with folders, not individual files. This helps it understand your project structure and provide better suggestions.
Save as workspace
A workspace saves your project settings and makes it easy to return to your project later.- With your
python-for-aifolder open, click “File” > “Save Workspace As…” - Save it in the same
python-for-aifolder - Name it
python-for-ai.code-workspace - Click “Save”
What’s a workspace?
A workspace is like a bookmark for your project. It remembers:- Which folder you’re working in
- Your editor settings for this project
- Which files you had open
- Your debugging configuration
Test your workspace
Let’s make sure the workspace works:- Close VS Code completely
- Go to your
python-for-aifolder - Double-click the
python-for-ai.code-workspacefile - VS Code opens with your project ready!
You can create a desktop shortcut to your workspace file for even quicker access to your project.
Project structure
Your folder should now look like this:Your first Python file
Create and run your first Python program