Posts T>T: Writing and Running Python Programs Locally

T>T: Writing and Running Python Programs Locally


This post is designed as a supplement to my Python programming course. For new programmers it is not obvious how to go from writing a program to running it, and in this post we discuss a simple means to achieve this.

Running Python Locally

  • Throughout the programming course we use Jupyter notebooks to do our programming but this is not a requirement to run Python code.
  • Python code is conventionally typed in a text editor and run locally on a users’ computer without need for internet access.
  • As you apply your programming knowledge in your own projects and future studies it will be of great benefit to know how this is done, which is now demonstrated using the Integrated Development Environment (IDE) Visual Studio Code.

  • IDEs are software applications that provide comprehensive facilities to computer programmers.
    • They contain a lot of useful features which assist you whilst you program, such as:
      • syntax autocomplete,
      • function lookup,
      • variable tracker,
      • data type lists and many more.
  • The following are my recommended IDEs:
  1. Visual Studio Code
  2. Spyder
  3. PyCharm
  • I personally use Visual Studio Code as it offers support for nearly every known programming language.
  • If you use multiple programming languages it can be cumbersome to have multiple IDEs corresponding to each language which you need to change to when needed.
    • Visual Studio Code allows me to do all my programming in a single software. It is also available on all 3 main operating systems, Linux, Mac and Windows.
  • I am not sponsored by Visual Studio Code. it is just my preferred IDE.

Install Visual Studio Code

  1. Visit the following link and download the software for your respective operating system:

    Visual Studio Code

  2. Check out the introductory video series on the basics of using VS Code.

  3. Install the Python extension by doing the following (Note Make sure to download the one with a capital P and has 43+ million downloads):

Running Python in VS Code

  1. Create file with extension .py symbolising a Python file.
  2. Type your Python code and save the file.
  3. Press the play button near the top right of the VS Code screen.


We have shown how VS Code offers a simple means of writing and running Python code all within the same window. This makes it easier to just write and run your code without worrying about the steps involved.

This post is licensed under CC BY 4.0 by the author.