PythonTeX
In this preview: PythonTeX code is not run yet, so its results are missing; the code is shown as written. A full run (latex, then pythontex, then latex again) runs the Python and puts the results in.
from math import comb, factorial
rows = [[comb(n, k) for k in range(n + 1)] for n in range(6)]
Ten factorial is
\py is not supported in this preview: not run, and
(310) is
\py is not supported in this preview: not run.
The sixth row of Pascal’s triangle: \py is not supported in this preview: not run.
def fib(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return a