| 1 |
% http://tex.stackexchange.com/q/299534/ |
| 2 |
\documentclass{article} |
| 3 |
\usepackage{pythontex} |
| 4 |
\usepackage[use-files]{xsim} |
| 5 |
|
| 6 |
\begin{document} |
| 7 |
|
| 8 |
\section{Test} |
| 9 |
|
| 10 |
\begin{exercise}[subtitle = Codeless Question,points=10] |
| 11 |
A question without code, worth 10 points. Subtitle and point values are in |
| 12 |
correct place. |
| 13 |
\end{exercise} |
| 14 |
\begin{solution} |
| 15 |
Solution 1 |
| 16 |
\end{solution} |
| 17 |
|
| 18 |
\begin{exercise}[subtitle = Codeful Question,points=15] |
| 19 |
Now with PythonTeX: |
| 20 |
\begin{pyblock} |
| 21 |
print("hello, world!") |
| 22 |
sum = 0 |
| 23 |
for j in range(0,100): |
| 24 |
sum += j |
| 25 |
print(sum) |
| 26 |
\end{pyblock} |
| 27 |
\end{exercise} |
| 28 |
\begin{solution} |
| 29 |
Solution 2 |
| 30 |
\end{solution} |
| 31 |
|
| 32 |
\end{document} |