Python Arrays You Can Run
Activate a small isolated array computation and compare its output.
Python Arrays You Can Run
Activate a small isolated array computation and compare its output. This article belongs to the synthetic M7 After inspection collection; its numbers, experiments, and local materials are fictional.
A small array calculation
Activate the playground to calculate a sum, mean, and squared values. The code is deliberately small enough to compare with the inert example below.
<CodePlayground language="python" source="import numpy as np\nvalues = np.array([2, 4, 6, 8])\nprint("sum:", values.sum())\nprint("mean:", values.mean())\nprint("squares:", (values ** 2).tolist())" />
values = [2, 4, 6, 8]
mean = sum(values) / len(values)
print(mean)
MathematicsRendering this equation locally; the complete source follows.2 + 4 + 6 + 8 = 20Execution starts only after Run. Stop removes the active surface; the existing ten-second Python limit remains in effect.
Continue inspecting
Exploring a Small Parameter Grid offers another combination. Browse all showcase posts.