# Online Python compiler (interpreter) to run Python online.
# Write Python code in this online editor and run it.
def greet():
print("Hello, Tutorsbot!")
greet()
Write a Python script, press Run and read the output a moment later. NumPy, pandas, SciPy and SymPy are already installed, so data and maths code runs without pip. Errors come back as normal Python tracebacks with the line number, and one click gives you a link to share the script.
import pandas as pd
df = pd.DataFrame({
"city": ["Pune", "Delhi", "Pune", "Chennai"],
"sales": [120, 90, 60, 150],
})
print(df.groupby("city")["sales"].sum().sort_values(ascending=False))
Most online Python compilers stop at the standard library. This one also has the four packages people ask for most often when they practise data and maths work:
groupby, merges and reading CSV textThe standard library is all there too, including json, csv, sqlite3, datetime, collections, itertools, statistics, re, dataclasses and asyncio. Importing pandas takes about a second, so the first run of a pandas script feels a little slower than plain Python.
Some packages are not installed: matplotlib, seaborn, scikit-learn, Pillow, requests, BeautifulSoup, turtle and tkinter. You cannot run pip install either. If you need a chart, print the numbers or a DataFrame here and draw the chart in a notebook. If you need a model from scikit-learn, a notebook is the better tool for that job as well.
Type or paste your code into the editor and press Run, or Ctrl+Enter (Cmd+Enter on a Mac). Output from print() appears in the output panel. If the script fails, you get the same traceback Python prints on your own machine. The last line names the error, for example ZeroDivisionError: division by zero, and the line above it shows the exact code that failed.
The editor keeps your script in your browser, so a refresh or a closed tab does not lose it. The share button copies a short link with your code in it, which is the quickest way to show a bug to a classmate or a mentor. The download button saves the script as a .py file you can run later with python script.py.
urllib and sockets fail with Temporary failure in name resolution, so API calls and web scraping will not work here.input() receives nothing. The next section shows a three-line workaround.open("notes.txt", "w") and read it back later in the same script, which is handy for practising file handling. The file is gone when the run ends.Judge sites feed your program its input on standard input. Here, you can put the sample input in a string and replace input() with a function that reads from it. Your solution code then stays exactly as you would submit it:
data = """3
4 9 2"""
lines = iter(data.splitlines())
input = lambda prompt="": next(lines)
n = int(input())
nums = list(map(int, input().split()))
print(n, sum(nums)) # 3 15Paste the problem's sample input between the triple quotes, run it, and compare the output with the expected answer. Before you submit, delete the first three lines so the judge's real input reaches your code.
If you are new to Python, these short programs cover the ideas most first lessons teach. Each one runs in well under a second.
n = 7 then print("even" if n % 2 == 0 else "odd"). Change n and run it again.a = 12 and b = 30, then print(f"{a} + {b} = {a + b}"). This shows f-strings, which you will use constantly..split() and pass the list to collections.Counter to see how often each word appears.sum(marks) / len(marks) with statistics.mean(marks), then try statistics.median.sqlite3.connect(":memory:") gives you a real SQL database that exists only for the run. Create a table, insert three rows and query them.When one of these works, change one thing at a time and run it again. That habit teaches you more than reading the finished answer.
Each tool suits a different job. Use this page for quick scripts, interview and exam practice, checking how a built-in function behaves, and sending someone a runnable snippet. It opens instantly, needs no account, and the link you share runs the same code for everyone.
Use Google Colab or another notebook when you need charts, machine learning libraries or long-running jobs, since notebooks keep state between cells and let you install packages. Use VS Code with Python installed locally when your work spans several files, needs a virtual environment, or talks to the internet.
People also ask whether Python is a compiler or an interpreter. The standard Python implementation does both: it compiles your source to bytecode, then its interpreter runs that bytecode. That is why a syntax error is reported before any of your code runs, while a NameError only appears when Python reaches that line.