test.tex
601 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
\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}