You are generally asked to submit your homework in a single PDF file. It is recommended that you compose your answers in Jupyter Notebook format (.ipynb) using, e.g., JupyterLab. This will include all your (commented) code cells and corresponding outputs, as well as other write ups in markdown cells. It is also recommended that you write your mathematical equations using LaTeX syntax which will be rendered typeset-ready in both plot texts and markdowns.
To generate a PDF file out of the .ipynb file, first export the notebook to an HTML file using the “Save and Export Notebook As” menu item in “File”. Then, open the .html file in your browser and use the “Print” → “Save to PDF” or “Print to PDF” function of your browser to produce the PDF file.