test.tex 601 Bytes
\documentclass{article}

\usepackage{pytex}
\parindent=0pt

\begin{document}

***\pyv{" ".join(s.capitalize() for s in "hello world!".split())}***

*\pyx{x=40}**\pyv{x+2}***

***\pyd{hello}{x+2}***\hello***

\begin{pyexec}
def fact (n) :
    f = 1
    for i in range(1, n+1) :
        f *= i
    return f
\end{pyexec}

\begin{pyeval}
[fact(n) for n in range(10)
 if n % 2 == 0]
\end{pyeval}

**********************

Code ``\pyc{lambda x : x + 1}'' is inlined.

Code block:
%
\begin{pycode}
def fact (n) :
    f = 1
    for i in range(1, n+1) :
        f *= i
    return f
\end{pycode}

\end{document}