Online NumPy Compiler
Output
Run real NumPy code in your browser — arrays, reshape(), slicing, matrix multiplication and statistics — with no pip install and no login. Made for NIELIT O Level M3 (Python) and anyone learning NumPy.
How to Use This Online NumPy Compiler
- The editor already has a working NumPy program — press Run (or Ctrl + Enter) to see its output.
- The first run takes a few seconds while Python and NumPy load into your browser; after that it is instant.
- Open Examples for arange/reshape/slicing, statistics and matrix programs, or write your own after
import numpy as np. - Errors appear in Output with the line number. Share code sends the program as a link.
NumPy Basics You Can Try Here
np.array([1, 2, 3]) makes an array; np.arange(1, 13) makes 1 to 12; a.reshape(3, 4) turns 12 values into 3 rows and 4 columns. a.shape, a.ndim, a.size and a.dtype describe an array.
Indexing and slicing work like lists, with one comma per dimension: m[0] is the first row, m[:, -1] the last column, and a[a % 2 == 0] keeps only the even values. Arithmetic is element-wise — a + b, a * 2 — while np.dot(a, b) or a @ b is the matrix product and a.T the transpose.
For statistics use sum(), mean(), np.median(), std(), max() and argmax(); axis=0 works down the columns and axis=1 across the rows.
Why Use NumPy Instead of a List?
A Python list adds two lists by joining them: [1, 2] + [3, 4] gives [1, 2, 3, 4]. A NumPy array adds them value by value: np.array([1, 2]) + np.array([3, 4]) gives [4 6]. Arrays hold one data type, use less memory and do whole-array maths without a loop — which is why NumPy is the base of pandas, matplotlib and machine learning in Python.
Your Code Stays on Your Device
Nothing is sent to a server: Python and NumPy run inside your browser, in a separate worker, so an endless loop is simply stopped after 15 seconds. Your last program is remembered on this device.
Frequently Asked Questions
Is this online NumPy compiler free?
Yes, free with no login and no limit. NumPy runs inside your own browser (Pyodide, real CPython compiled to WebAssembly), so there is nothing to install and your code is never sent to a server.
Do I need to pip install NumPy?
No. Write import numpy as np and press Run. NumPy is downloaded into the browser the first time, which takes a few seconds; after that every run is instant. pandas and matplotlib load the same way.
Which NumPy functions work here?
All of them, because it is the real NumPy library: np.array, np.arange, np.linspace, reshape, slicing and boolean indexing, np.dot and @ for matrix multiplication, .T for transpose, sum, mean, median, std, max, argmax, np.random and np.linalg.
Can I use input() with NumPy?
Yes. When the program reaches input(), the question appears in the Output terminal — type the answer there and press Enter. For example np.array(list(map(int, input().split()))) turns a line of numbers into an array.
Can I draw graphs with matplotlib?
Yes. Import matplotlib.pyplot as plt, draw the chart and call plt.show() — the chart appears as a picture under your output.
Is NumPy in the O Level M3 syllabus?
Yes. NIELIT O Level M3-R5.1 (Programming and Problem Solving through Python) has a NumPy chapter: creating arrays, array attributes, indexing and slicing, and basic array operations. Every example on this page is from that chapter.
