Environment Setup

Before we start coding, we need to set up a professional development environment. Python is relatively easy to install on any OS.

1. Downloading Python

Go to python.org and download the latest stable version of Python 3.

Important (Windows): During installation, make sure to check the box that says "Add Python to PATH". This allows you to run Python from your terminal.

2. Checking Installation

Open your terminal or command prompt and type:

python --version
# OR
python3 --version

3. Choosing an Editor (IDE)

While you can use simple text editors, VS Code is highly recommended due to its excellent Python extension.

  • Install the Python extension by Microsoft in VS Code.
  • It provides IntelliSense (autocompletions), linting, and debugging support.

4. Virtual Environments

Virtual environments keep your project dependencies separate. Never install packages globally unless you have a good reason.

# Create a virtual environment
python -m venv venv

# Activate it (Windows)
.\\venv\\Scripts\\activate

# Activate it (macOS/Linux)
source venv/bin/activate

5. The REPL

You can run Python interactively by simply typing python in your terminal. This is great for testing quick snippets of code.