Код: Выделить всё
import sympy as sp
import numpy as np
import random
import matplotlib.pyplot as plt
import string
latex_document = ""
for counter in range(1, 301):
# Random parameters for the function
k = random.randint(2, 9)
x0 = random.choice([i for i in range(1, 9) if i != 0])
y0 = random.choice([i for i in range(1, 9) if i != 0])
# Initialize the LaTeX document
latex_document += r"""
% Positioning of the string of zeros in the top-right corner
\begin{textblock*}{2cm}(17cm, 1cm) % Modify position and size as needed
\textbf{000""" + str(counter) + r"""}
\end{textblock*}
\begin{center}
\large{{\bf Name of the class}}
\vspace{0.2cm}
{\bf November 29, 2026 }\\[.2cm]
Name of the teacher \\[1ex]
\vspace{0.3cm}
Surname, Name, Student ID .........................................................................
\end{center}
\vspace{0.5cm}
\normalsize
\begin{enumerate}
\item Write the function
\[
f(x, y) = \sqrt{{%d - (x - %d)^2 - (y - %d)^2}} + \frac{1}{x - %d}
\]
""" % (k, x0, y0)
# Close the document
latex_document += r"""
\end{enumerate}"""
# Save the LaTeX document to a file
with open('quiz.tex', 'w') as f:
f.write(latex_document)
print("LaTeX document generated and saved as 'quiz.tex'.")
Код: Выделить всё
ValueError: unsupported format character 'I' (0x49) at index 34
Подробнее здесь: https://stackoverflow.com/questions/792 ... ython-late
Мобильная версия