Playground
The same runner the JavaScript panels use, with the assertion helper already defined. Python cannot run in a browser, so this is JavaScript only.
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
const test = (name, got, want) => console.log(
(same(got, want) ? 'ok ' : 'FAIL ') + name +
(same(got, want) ? '' : ` got ${JSON.stringify(got)}, want ${JSON.stringify(want)}`)
);
// Never use === on a computed float. See the Foundations lesson on floating point.
const close = (a, b, tol = 1e-9) => Math.abs(a - b) < tol;
// Try something. test(name, got, want) prints ok or FAIL.
const dot = (a, b) => a.reduce((n, x, i) => n + x * b[i], 0);
console.log('dot([1,2,3],[4,5,6]) =', dot([1, 2, 3], [4, 5, 6]));
test('the dot product', dot([1, 2, 3], [4, 5, 6]), 32);
Output