Half the small Python scripts I write are throwaway checks. I want to see what np.sort(scores)[-2:] returns, check a pandas groupby on five rows, or verify a bs4 selector on a snippet of HTML. Spinning up a virtual environment on a lab computer or a borrowed laptop takes longer than writing the six lines of code.
Running Python directly inside the browser tab fixes that setup tax. Because the runtime executes locally in the page rather than waiting on a shared container queue, common packages load on demand without touching your system Python.
Here is a quick snippet I ran to check array slicing and sorting:
import numpy as np
scores = np.array([72, 85, 91, 68, 94])
print("count:", len(scores))
print("mean:", round(float(scores.mean()), 2))
print("top 2:", np.sort(scores)[-2:].tolist())
That prints:
count: 5
mean: 82.0
top 2: [91, 94]
Five libraries you can import right away (plus !pip install)
On the free browser Python runner I work on (https://dsatracker.tech/online-compiler/python, disclosure: my project, no sign-up needed to run), five libraries students reach for often work straight from import:
-
numpyfor array math and matrix checks -
pandasfor small CSV or DataFrame transforms -
requestsfor HTTP examples -
cv2(OpenCV) for image-array checks -
bs4(BeautifulSoup) for HTML parsing
If a quick script needs another pure-Python package from PyPI, you can also put a !pip install <package> line at the top of the file and run it like a notebook cell.
Two habits that save wasted runs
First, fill the separate Input box before you click Run whenever your script calls input(). Online runners do not pause mid-execution for live keyboard typing; they pass the entire Input box as stdin when the script starts. Putting test lines there upfront avoids the classic EOFError and stops you from waiting on a "session ended" prompt.
Second, when a loop or recursive function prints the wrong answer, switch from guessing print() lines to a step-by-step trace. The same workspace includes Dry Run, which steps through Python line by line and draws variables, lists, and memory arrows so you can see which reference changed.
Next time you only need to verify a pandas filter or a 10-line recursion helper, skip creating a fresh venv and test it straight in a tab.
Top comments (0)