Python Environment

Get introduced to different Python environments, and a brief overview of Python’s code structure and module.

If you’re just starting to learn Python, it’s important to know about the different places where we can write, test, and use Python code. Let’s discuss some easy-to-use places where we can do that:

Local development environment

This is where we write and test Python code on our own computer. This environment includes helpful tools to enhance our Python learning experience:

  • Python interpreter: Install Python from their official website or through package managers like Anaconda.

  • Text editor or integrated development environment (IDE): Choose from beginner-friendly IDEs like PyCharm and Visual Studio Code or simple text editors like Sublime Text or Atom.

Here are a few reasons why using a local development environment is advantageous:

  • Allows us to work offline

  • Provides full control over our development environment

Online Python editors

There are a number of web-based platforms where we can write and execute Python code without installing anything on our computer, such as Repl.it, Trinket, and Google Colab, to name a few popular editors.

Some of the benefits of using online Python editors are:

  • Quick and easy setup, especially for beginners

  • Accessible from any device with an internet connection

Jupyter Notebooks

Interactive documents that allow us to write and execute Python code in a browser environment. We can install Jupyter Notebook or use online platforms like Google Colab.

A few benefits of using Jupyter Notebooks are:

  • Ideal for data analysis, visualization, and documentation

  • Supports mixing code with markdown for explanations

Install Jupyter Notebook via Anaconda or use Google Colab, create a new notebook, and start coding and documenting your Python projects.

Cloud-based development

Utilizing cloud platforms to facilitate scalable and collaborative development. Consider AWS Cloud9, Microsoft Azure’s Python SDK, or Google Cloud Platform’s Cloud Shell.

A few of the benefits of cloud-based development are listed below:

  • Access to scalable computing resources

  • Built-in integrations with cloud services

  • Seamlessly collaboration with advanced development features

How is Python code structured?

Python code is structured using a combination of indentation and syntax. Statements and expressions are written in a straightforward manner with minimal punctuation.

Unlike many other programming languages that use braces {} or keywords like begin and end to define blocks of code, Python uses indentation. Blocks of code, such as those within loops, conditional statements, or function definitions, are indicated by the same level of indentation. This indentation is typically four spaces, but it can be any consistent whitespace. A simple example is given below:

Get hands-on with 1200+ tech skills courses.