The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.

Sun 30 October 2022

17 Online Python IDEs and Interactive Shells/REPLs

Posted by Al Sweigart in python   

Installing Python is easy, but maybe you're on a smartphone/tablet, are on a library computer that doesn't let you install software, or can't install Python for some other reason. This article has a list of 17 free Python interpreters and interactive shells (also called REPLs) that you can access from a web browser.

There are some downsides to using a browser-based Python interpreter. You won't be able to read or write files with the open() function or make network connections. You might not be allowed to have long-running programs or programs that use a lot of memory. And you won't be able to install third-party modules such as NumPy, Pandas, Requests, PyAutoGUI, or Pygame (though some will have these modules pre-installed.) Some other Python features might be disabled; you'll have to check with them individually. Some of these require you to sign up for a free account. You can use 10 Minute Email to create disposable email accounts if you don't want to deal with spam.

However, you'll still be able to practice writing Python code. The game, simulation, and digital art projects in my book The Big Book of Small Python Projects will still work in these online interpreters. You'll also be able to enter the text-based game projects from Invent Your Own Computer Games with Python and the encryption and code-breaking projects from Cracking Codes with Python.These books are free to read online through a Creative Commons license.

Here's a curated list of browser-based Python interpreters. This isn't a hastily put together clickbait blog post; I've examined each of these and listed them in order of my personal preference.

Python Tutor

https://pythontutor.com/

My favorite browser-based Python file editor is Python Tutor. Python Tutor offers a built-in debugger that lets you execute one line at a time and inspect how the program executes. Not only that, but it also records the state of the program at each step, so you can also step backwards. This is a feature most debuggers don't have.

The Python Tutor site also has Java 8, JavaScript ES6, and C/C++ (with the gcc 9.3 compiler). It also has Python 2.7, TypeScript 1.4, and Ruby 2.2, though these are unsupported. The main downside is that there is a limit to the runtime for your programs (since the programs are run on their servers before returning the output to your browser), however you won't hit this for most learning exercises when you're just starting.

Python Anywhere

https://www.pythonanywhere.com/

PythonAnywhere is one of the most popular browser-based interpreters. You must sign up first, but free accounts are available. You'll be able t to store your Python scripts, or just use their IPython interactive shell without having to log in. Their service allows you to read and write files to a virtual hard drive, and they have many popular Python third-party modules already installed. They have several different Python versions available, and PythonAnywhere is also used for the interactive shell on the Python.org website.

Replit

https://replit.com/

Replit requires you to sign up for a free account to use it. The user interface is a bit complicated, as they have several features including a help system to navigate the site. The site also has online compilers for C, C++, Java, JavaScript, and several other languages.

Replit also has a mobile app for programming on smartphones and tablets.

Brython

https://brython.info/tests/console.html?lang=en

Brython is Python that you can run in your browser the way web browsers run JavaScript. The normal client-side things you can do in a web page with JavaScript can be done with Brython. This means you can run programs without limits on memory or runtime since they'll be running on your own computer. The downside is that your browser must first download the 6 megabyte Brython code whenever it loads the web page.

You can avoid this by downloading Brython and running it off of your computer. This way you won't need an internet connection after downloading Brython. First, download Brython-3.11.0.zip from the Brython release page on their GitHub account (or whatever the latest version you see on that page). Unpack the Brython-3.11.0 folder inside the zip. Create a new text file named console.html (or any name with a .html extension you choose) and put the following text into it:

When you open this .html file on your computer, you'll have a working Python interactive shell.

Google Colab

https://colab.research.google.com/

Your Google or GMail account can give you access to a Jupyter Notebooks-style REPL with generous memory and runtime limits.

Trinket

https://trinket.io/

Trinket is an education-focused site. You need to sign up for a free account to use it, but their interactive shell also supports Turtle, Matplotlib, and other modules that many online REPLs don't.

Python Fiddle

http://pythonfiddle.com/

Python Fiddle is a bare bones editor that lets you create and run Python scripts. Their user interface is a bit unwieldy, but it is rather straightforward.

Programiz

https://www.programiz.com/python-programming/online-compiler/

Programiz has a simple file editor. It can't write files and the programs have a limited runtime. The website also has compilers for C, C++, Java, C#, JavaScript, and a sandbox for SQL databases and HTML/CSS.

Ideone

https://ideone.com/

Ideaone has a rich editor and supports several programming languages besides Python (even older languages like Pascal, Fortran, Prolog, and Cobol, and esoteric programming languages like Brainfuck and Intercal). There's only the editor that lets you write and run programs (with a 5 second runtime limit), but no interactive shell. I think Ideaone is better if you want to practice in less popular languages, rather than use it on a common basis for Python.

SymPy Live Shell

https://live.sympy.org/

A Jupyter Notebooks-style REPL with a small user interface that is fine for casual examples. It uses JupyterLite to run JupyterLab entirely in your browser rather on their servers.

OnlineGDB

https://www.onlinegdb.com/online_python_interpreter

A decent editor that has a nice user interface without being too overwhelming. The runtime and memory limits seem quite generous too. I'd recommend this one.

W3Schools Python Shell

https://www.w3schools.com/python/python_compiler.asp

W3Schools has a straightforward Python editor with basic syntax highlighting. It has a runtime limit of about 10 seconds, though it doesn't report an error if your program goes over it. It's fine for simple examples.

Python Principles Online Python Interpreter

https://pythonprinciples.com/online-python-interpreter/

A simple file editor, but I had trouble getting it to run anything more than a toy example.

Online Python Beta

https://www.online-python.com/

A simple and straightforward Python editor that runs the code on their back-end. Good for toy examples.

TutorialsPoint

https://www.tutorialspoint.com/execute_python_online.php

A simple and straightforward editor with generous runtime limits.

RexTester

https://rextester.com/l/python3_online_compiler

This looks like a hobbyist project with a minimal editor and 5 second runtime limit. There are compilers for other languages, but the website is hard to navigate.

Portable Python

https://portablepython.com/ (NOT RECOMMENDED

This isn't a browser-based REPL, but rather a .exe file to run Python on Windows without having to install anything. However, the page hasn't been updated since 2013 (and Python 3.2), and the download pages don't use HTTPS. I recommend against using this software due to the possibility of malware.

Visual Studio Code Online

https://vscode.dev/

Visual Studio Code is an Electron app, meaning that it can run as a regular desktop app or a browser-based app. The browser version is a bit limited, and navigating this online IDE has a steeper learning curve than the other online interpreters. Still, if you're willing to dive into it or already have experience with Visual Studio Code, you can use this browser-based version.

Learn to program for free with my books for beginners:

Sign up for my "Automate the Boring Stuff with Python" online course with this discount link.