2. Setting up the Python Environment

2. Setting up the Python Environment

To start programming in Python, you need to set up your development environment: To set up Python:

  1. Download Python from python.org

  2. Install Python, ensuring to add Python to PATH

  3. Verify installation by opening a command prompt and typing python --version

  4. Install an Integrated Development Environment (IDE) like PyCharm , Visual Studio Code, Jupyter Notebook, Google Colab or use IDLE (comes with Python). In our case, we will use Google Colab in most cases in the coding practices.

# Example Code

import sys
print(f"Python version: {sys.version}")
print(f"Python executable Path: {sys.executable}")

Tools:

  1. VS Code:

    • Install Python.

    • Install VS Code, then add the Python extension.

    • Create a .py file and run with Ctrl+F5.

  2. Google Colab:

  3. Jupyter Notebook:

    • Install via pip install jupyterlab.

    • Launch with jupyter lab and create a new notebook.

Lab Setup Task (10 mins):

  • Open VS Code and run:

    pythonCopy

    print("Hello, Python!")
  • Create a Colab notebook and execute the same code.

Last updated