Python code does not format properly and Overleaf just outputs 1 page despite code being longer than that

This is what it looks like:

The code gets off the margins and the output is only 1 page.

All I added to the code was

\begin{document}
\begin{verbatim}

<code>

\end{verbatim}
\end{document}


Please tell me what the problem is.

• please post an example that shows the problem, it's hard to debug code shown as an image. Normally verbatim will break over a page so code you have not shown is stopping that, although you will need to adjust the long lines (or use a package such as listings that allows line breaking) for the lines that cross the right margin. – David Carlisle Aug 4 at 9:09