\section{Exercises}
\begin{footnotesize} 
\subsection*{Targeted exercises} 
\subsubsection*{Exercises for Section \ref{Writing_text_files_with_arbitrary_formatting_using_with_open}} 
\begin{enumerate}\setcounter{enumi}{-1}
	\item  Produce a narrative fit report, that explains the model, the fit approach, and the results for the linear fit produced by the final code in  Chapter 5. 

    \item Modify the example code shown for Section \ref{Drawing_molecules_with_RDKit} to save the molecular drawing as both svg and png images. This can be done by append the following to the end of the code:
    \begin{lstlisting}
Draw.MolToFile(acetate_mol, "acetate.png", size = (100, 100)) # saves a png

svg_data = Draw.MolToSVG(acetate_mol, size = (100, 100)) # generates svg specifications as a string

with open("acetate.svg") as a:
	a.write(svg_data)
    \end{lstlisting}
    Once you have the images, bring both of them into a Microsoft Word document or Powerpoint presentation (or similar software). Make both 3 inches wide. Change the colors of the bonds (if you can). Do you notice any advantages of svg or png? 

	
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Making_Microsoft_word_tables_using_docx}} 
\begin{enumerate}\setcounter{enumi}{1}
	\item  Write out the slope and intercept values from the final code in Chapter 5 as a table in Microsoft word.

	
\end{enumerate}
\subsection*{Comprehensive exercises} 
\begin{enumerate}\setcounter{enumi}{2}
	\item  We have just learned we can open files and write them, using the \lstinline{with open()} construction. We could have done this to read files as well. For well-structured files, functions like \lstinline{genfromtxt()} are quicker and more efficient. However, there are times that you will need to use the \lstinline{with open()} to process a file line-by-line. This is done using:
\begin{lstlisting}
 with open ( < file > , 'r ') as f : # the 'r ' indicates the file is open in read mode
     for line in f : # this reads the file line by line
    < do what you want with each line >
\end{lstlisting}
	With this knowledge, go back and re-create the plot we made at the end of Chapter 2, but import the data from the file using the \lstinline{with open()} construction.

\item Starting with the code written at the end of this chapter, modify it so that it also includes the image of the fit result that is produced by the code. Include a helpful caption.  You can use the Spyder plots window to save the image to a file.
    
\end{enumerate}
\end{footnotesize} 
