A free online Python interpreter, with no ads
Pyground runs real Python (CPython, compiled to WebAssembly by Pyodide) right in your browser. There is nothing to install, no account to make and nothing to pay. Write code in the editor, press Ctrl+Enter, and see the result in the output.
Features
- input() works. Programs can ask questions and you answer inline in the output.
- Plots appear inline. matplotlib figures show up where
plt.show()is called. - Batteries included. numpy, pandas, scipy, matplotlib and more load automatically when you import them.
- pip packages. Import a package that is not installed and Pyground offers to install it from PyPI.
- Stop anytime. Infinite loop? Press Stop and the page stays responsive.
- Share a link. Your code is packed into the link itself, so no server stores it.
Privacy
Your code never leaves your browser. Pyground has no backend, no accounts, no cookies, no analytics and no ads. Code is saved in your browser's local storage so it is still there when you come back. Python itself and any packages you import are downloaded from the jsDelivr CDN and PyPI.
Limits
Pyground runs in a browser sandbox, so programs cannot open network sockets, use threads, or install packages that need compiled code unless Pyodide already ships them. Installed packages last until you close or reload the tab.
Try an example
import random
secret = random.randint(1, 20)
for attempt in range(1, 6):
guess = int(input("Guess a number from 1 to 20: "))
if guess == secret:
print(f"Correct, in {attempt} tries!")
break
print("Too low" if guess < secret else "Too high")
else:
print("Out of tries. It was", secret)
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2 * np.pi, 200)
plt.plot(x, np.sin(x), label="sin(x)")
plt.plot(x, np.cos(x), label="cos(x)")
plt.legend()
plt.title("Sine and cosine")
plt.show()
import pandas as pd
sales = pd.DataFrame({
"month": ["Jan", "Feb", "Mar", "Apr"],
"units": [120, 95, 140, 160],
"price": [9.5, 9.5, 10.0, 10.0],
})
sales["revenue"] = sales["units"] * sales["price"]
print(sales)
print("\nTotal revenue:", sales["revenue"].sum())