In [1]:
header1 = r"""\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[croatian]{babel}
\usepackage{minted}
\usepackage{amsmath,amsfonts}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage[hmargin=1.5cm,vmargin=1cm]{geometry}
\pagestyle{empty}
\begin{document}
"""
header2 = r"""\begin{center}
{\LARGE \textbf{1.\ kolokvij iz Matematičkog sofvera}}\\
{\Large\textbf{12.\ svibnja 2017.}}\\
\end{center}
"""
header3=r"""\begin{enumerate}
"""
footer1 = r"""\end{enumerate}
\vspace{5mm}
\textbf{Uputa}: Kolokvij se piše u Jupyter bilježnici (unutar direktorija \textit{1.\ kolokvij})
koju sam kreirao u tu svrhu.
Drugi zadatak se rješava korištenjem biblioteke \texttt{Numpy},
treći korištenjem biblioteke \texttt{Scipy}, četvrti korištenjem
biblioteke \texttt{Matplotlib} a peti korištenjem biblioteke \texttt{Sympy}.
\vspace{5mm}
\begin{flushright}
Potpis studenta:
\end{flushright}
\newpage
"""
footer2=r"""
\end{document}
"""
In [2]:
from numpy import random
with open('studenti.txt','r') as f:
studenti = list(f)
broj_studenata = len(studenti)
broj_zadataka = 30
In [3]:
datoteka = "ms_kol1.tex"
with open(datoteka,'w') as f:
f.write(header1+'\n')
for i in range(broj_studenata):
random.seed()
r=random.randint(1,broj_zadataka,5)
f.write(header2)
f.write("\\begin{center}{\large \\textbf{Student: "+studenti[i][:-1]+"}}\end{center}\n\n")
f.write(header3)
for j in range(5):
z = str(j+1)+str(r[j]).zfill(2)
f.write('\\input zadaci-1/z'+z+'\n')
f.write(footer1)
f.write(footer2)