\section{Exercises}
\begin{footnotesize} 
\subsection*{Targeted exercises} 


\subsubsection*{Exercises for Section \ref{Importing_libraries_to_add_capabilities_to_Python}} 
\begin{enumerate}\setcounter{enumi}{-1}
	\item  In the IDLE or console of an IDE, import Numpy, and calculate the following. It may be helpful to know the following about Numpy: if you import Numpy as \lstinline{np} then base-10 logarithms are accessed using \lstinline{np.log10}, the value of $\pi$ is accessed using \lstinline{np.pi}, the value of $e$ is accessed using \lstinline{np.e}.
    \begin{enumerate} 
	\item $\ln(1)$
	\item $\ln(10)$
	\item $\ln(e)$
	\item $\log_{10}(1)$ 
	\item $\log_{10}(10)$ 
	\item $\log_{10}(e)$ 
    \end{enumerate}
    
\item  In this chapter we introduced log operations, but Numpy introduces more mathematical operations.  Using the Numpy documentation, a web search, or an AI tool, figure out how to calculate the following using Numpy:
    \begin{enumerate}
        \item $-e^\pi$
	\item $\sqrt{\pi}$ 
	\item $\sin{\frac{\pi}{3}}$ 
	\item Greatest common denominator of 275 and 385
	\item Least common multiple of 12 and 27
    \end{enumerate}


    
\item  Using Numpy, calculate the half life of a material with a decay rate of $1.3\times10^{-6} s$. 

\end{enumerate}



\subsubsection*{Exercises for Section \ref{Operating_on_collections_of_data_efficiently_with_Numpy_arrays}} 
\begin{enumerate}\setcounter{enumi}{2}
	\item  Use a Numpy array to complete the following steps:
    \begin{enumerate}
        \item Make an array that holds the following pH values: 1.1, 2.2, 3.3, ..., 9.9.
	\item  Use this array to calculate the concentration of protons at each p$H$. 
	\item  Dilute all concentrations by a factor of 10.
	\item  Convert the diluted concentrations back to p$H$.
    \end{enumerate}


    
\item  You wish to make a simple syrup that contains alcohol. You mix 220 g of glucose with 220 g of ethanol and then add enough water to bring the final volume to 0.75 L. What is the concentration of the glucose and the ethanol?  Use a Numpy array to complete this calculation.

\item  Numpy has many other functions, which are built to work with Numpy arrays. For instance, \lstinline{numpy.sum()} can give you the sum of all elements in an array. Use this knowledge to find out the total concentration of solutes in Exercise 4.

\item  You are doing a variable temperature NMR experiment at 8 equally-spaced temperatures from -10$^\circ$C to 60$^\circ$C. You have two isomers that exchange and the $\Delta{G}$ of isomerization is $10kJ/mol$.  For each species, calculate the concentration/relative population at each temperature. 

\end{enumerate}


\subsubsection*{Exercises for Section \ref{Interpreting_Python_error_messages_to_fix_mistakes}} 
\begin{enumerate}\setcounter{enumi}{6}
	\item  Write code that, when run, generates an error of each type below.  You might wish to consult the technical chapter on errors (Chapter \ref{Errors}) or the internet.
    \begin{enumerate}
        \item Errors in variable naming.
	\item Errors in making an array.
	\item Adding vectors of different shape.
	\item Using a function incorrectly.
	\item Syntax errors.
	\item Indentation error.
	\item Forgotten colon (:).
    \end{enumerate}

\end{enumerate}


\subsubsection*{Exercises for Section \ref{Structuring_data_using_arrays_of_arrays}} 
\begin{enumerate}\setcounter{enumi}{7}

\item  Make a $3\times3$ Numpy 2D array, in which each index holds a different number from 1--9:
    \begin{enumerate}
        \item  Make the numbers count up by one as you go across the ``rows.''
	\item Make the numbers count up by one as you go down the ``columns.''
    \end{enumerate}



    
\item  Imagine you had 4 solutions that had concentrations of 1.0M, 0.70M, 0.55M, and 0.13M.
    \begin{enumerate}
        \item Make a Numpy array that holds these concentrations.
	\item Create a 2D array that holds three sets of arrays that would represent serial dilution of these concentrations by a factor of 3, performed twice. 
	\item Subtract the array you just made from a 2D array that represents 12 solutions all of 1.00M concentration.
    \end{enumerate}


    
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Generating_arrays_of_all_ones_or_zeros_Numpy}} 
\begin{enumerate}\setcounter{enumi}{9}

\item  Make a 15 element 2D Numpy array where all elements have a value of 0.33.
    \begin{enumerate}
        \item Make this array, using \lstinline{numpy.ones()}
	\item Make this array, using \lstinline{numpy.ones_like()}
	\item Make this array, using \lstinline{numpy.zeros()}
	\item Make this array, using \lstinline{numpy.zeros_like()}
    \end{enumerate}
	
\end{enumerate}


\subsubsection*{Exercises for Section \ref{Generating_an_array_of_equally_spaced_numbers_using_Numpy}} 
\begin{enumerate}\setcounter{enumi}{10}

\item  Create the following Numpy arrays. You cannot just type out the values to create the array, you must use at least \lstinline{numpy.linspace()} or \lstinline{numpy.arange()} in your solution:
    \begin{enumerate}
        \item An array from 0 to 10, not including 10, with 10 elements, using \lstinline{numpy.arange()}.
	\item An array from 0 to 10, not including 10, with 10 elements, using \lstinline{numpy.linspace()}.
	\item An array spanning 0 to 10, including 10, with 10 elements.
	\item An array spanning 0 to 10, including 10, with each element differing by 0.5. 
	\item An array from 0 to $2\pi$, not including $2\pi$ with 8 elements.
	\item Make an array that, when squared, has elements 0 to 10, equally spaced. 
	\item Using \lstinline{numpy.linspace()} and \lstinline{numpy.sin()}, make a Numpy array that has the values $0, \sqrt{2}, 1, \sqrt{2}, 0, -\sqrt{2}, -1, -\sqrt{2}$.
	\item An array spanning 1 to $10^{14}$ (including $10^{14}$), where each element is 10 times larger than the element before it.
    \end{enumerate}
\end{enumerate}


\subsubsection*{Exercises for Section \ref{Planning_a_multi-step_solution_to_a_complex_problem}} 
\begin{enumerate}\setcounter{enumi}{11}
	\item   You have created a series of molecules that you think will serve as p$H$ sensors, and you need to calibrate their responses to changes in p$H$. Write a code that will specify how much of a 6N HCl solution to use for 11 standards, each 10 mL in volume and which area equally spaced between two p$H$ that the user of the code can specify.

	\item  Draw a flow chart for the function produced at the end of Chapter 0.

	\item  Create a flow chart for how you might solve an ICE table in general chemistry course. 

\end{enumerate}


\subsubsection*{Exercises for Section \ref{Writing_scripts_to_execute_complete_solutions_in_one_click}} 
\begin{enumerate}\setcounter{enumi}{14}

\item  Create a file containing the solution to Exercise 2 and save it to a directory on your computer. 

\end{enumerate}


\subsubsection*{Exercises for Section \ref{Keeping_track_of_changes_to_your_code_using_versioning_practices}} 
\begin{enumerate}\setcounter{enumi}{15}

	\item  You wrote a Python script. You start at version 0.1.0 and go through the changes described below, in turn. Next to each entry, provide the version number that should be assigned to your script \textit{after} the changes. 
    \begin{enumerate}
        \item You add a new \textbf{keyword argument} to a function, with a default value that was originally hard coded.
	\item You notice a typo in a comment, and fix it
	\item You notice a typo in a function that breaks the function, and fix it.
	\item You add a new \textbf{positional argument} (that does not have a default value) to a function.
	\item You notice an mathematical error in a formula, and correct it.
	\item You decide to reorder the structure of your code.
	\item You have your code output additional text contextualizing results that are printed to the console. 
    \end{enumerate}
\end{enumerate}

\subsection*{Comprehensive exercises} 
\begin{enumerate}\setcounter{enumi}{16}
	\item  Take the final code from this chapter  and adapt it for a 384 well plate. You should  only need to change two numbers to do this. Try to ensure that the printed result is easy to follow.

	\item  You find that your pipette is only accurate to the nearest $0.1$ $\mu$L. Modify the final code in this chapter so that it prints out volumes rounded to the nearest $0.1$ $\mu$L. Looking at your answer, could you carry out this experiment if you had a pipet that was only accurate to $1$ $\mu$L? How do you know?

	\item  Your advisor decides that they want you to add a small amount of another solvent to your reaction mixture.  Modify the final code in the chapter to allow for the same arbitrary amount of that solvent to be added to each well. 
\end{enumerate}
\end{footnotesize} 
