\section{Exercises}
\begin{footnotesize} 

\subsection*{Targeted exercises} 
\subsubsection*{Exercises for Section \ref{Giving_your_computer_instructions_using_Python_commands}} 

\begin{enumerate}\setcounter{enumi}{-1}
	\item  Using Anaconda Navigator, verify that the following Python \acite{libraries} are installed, and if not, install them. If you want directions you can use the resources at the book's website (\website).

	\begin{enumerate}
            \item numpy
            \item scipy
            \item lmfit
            \item plotly
            \item kaleido
            \item pillow
            \item openpyxl
            \item python-docx
            \item rdkit
            \item nbformat
            \item codechembook
    \end{enumerate}
    
\item  Run plotly-test.py from the codechembook library. If you need more directions, refer to the resources at \website


\end{enumerate}
\subsubsection*{Exercises for Section \ref{Having_Python_do_basic_math_by_evaluating_mathematical_expressions}} 
\begin{enumerate}\setcounter{enumi}{1}
	\item  Compute the following outside of Python, and then have Python compute them. Compare the answers:

	\begin{enumerate}
	\item $9^{1/2}$
	\item $9^{0.5}$
	\item $5 + \frac{7}{8}$
	\item $5 + 7\div 8$
	\item $(5 + 7) \div 8$
	\item $(4 + 5)^{1/2}$
	\item $9 \div 3^2$
	\item $2^{3+1}$
	\end{enumerate}
    
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Accessing_capabilities_beyond_basic_math_using_functions}} 
\begin{enumerate}\setcounter{enumi}{2}
	\item  Compute the following outside of Python, and then have Python compute them. Compare the answers:

	\begin{enumerate}
	\item $2 - 3$
	\item $|3-2|$
	\item $4.5 +3.2 \times 7.8-12.1$
	\item $(4.5 +3.2) \times (7.8-12.1)$
	\item $(4.5 +3.2) \times (|7.8-12.1|)$
\end{enumerate}

\item  A arithmetic operator that is included in Python which you haven't used yet in this chapter is the modulo operator (\%). This produces the remainder of a division operation. Calculate the following

 outside of Python and using Python, and then compare the answers:

\begin{enumerate}
	\item $13 \div 10$
	\item $10 \div 13$
	\item $7 \div 2$
	\item $6 \div 2$
	
\end{enumerate}

\item  A function included in Python that you haven't yet seen is \lstinline{pow()}, which raises one number to the power of another and accepts two \textbf{positional argument}s and one \textbf{keyword argument}.  Use the \lstinline{help()} function to get information on how to use \lstinline{pow()}, and then use it to compute the following:

    \begin{enumerate}
	\item $2^{3.14}$
	\item $\sqrt{2}$
	\item $7^{3/4}$
	\item A rendering of Avogadro's number.
    \end{enumerate}
    
\item In Exercise 4, you learned modulo, and in Exercise 5, you learned to use the \lstinline{pow()} function. Using the \lstinline{pow()} function and modulo operator only, check to see if $7^3$ is a factor of 3. 

\item Compute the following answers, rounded to the specified number of digits, using the \lstinline{round()} function.  
	\begin{enumerate}
		\item $2\div 3$ rounded to the nearest thousandth.
		\item $\pi$ rounded to the nearest hundredth.
		\item $5.6^{3.2}$ rounded to the nearest tens digit.
		\item $1\div3.3$ rounded to the nearest billionth.
	\end{enumerate}
\end{enumerate}

\subsubsection*{Exercises for Section \ref{Clarifying_how_your_code_works_with_comments}} 
\begin{enumerate}\setcounter{enumi}{7}
	\item  Produce comments for the code you used to solve Exercises 3b, 4a, 5a, and 6.
\end{enumerate}

\subsubsection*{Exercises for Section \ref{Temporarily_storing_data_using_variables}} 
\begin{enumerate}\setcounter{enumi}{8}
	\item  Which of the following are valid variable names in Python? For invalid variable names, propose a new name that is acceptable. 

	\begin{enumerate}
		\item \lstinline{2nd_trial}
		\item \lstinline{length*width}
		\item \lstinline{^volume}
		\item \lstinline{def}
		\item \lstinline{__hidden_variable}
		\item \lstinline{_}
		\item \lstinline{fast component}	
	\end{enumerate}
    
\item  Create valid Python variables for the masses of carbon, hydrogen, oxygen, and nitrogen.  Then using these variables, compute the molar masses of:

	\begin{enumerate}
		\item $\ce{NO2}$
		\item water
		\item glucose
		\item benzene
		\item pyridine
		\item glycine
	\end{enumerate}


\item  Using only the mass of hydrogen, carbon, nitrogen, and oxygen, compute the mass of hexaglycine simply by adding up all the masses of the elements.

\end{enumerate}


\subsubsection*{Exercises for Section \ref{Accessing_a_history_of_code_you_have_executed_in_the_console}} 
\begin{enumerate}\setcounter{enumi}{11}
	 
	\item  Solve Exercise 11 and then, without retyping any code, press up until you highlight the line for calculating the mass of a single glycine.  Modify this line to store the mass as a variable. Then, use this new variable to calculate the mass of hexaglycine without using the atomic masses directly

	
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Expressing_data_as_readable_text_using_strings}} 
\begin{enumerate}\setcounter{enumi}{12}
	\item  Enter each of the following into the console and press return, then also put the value inside a \lstinline{print()} statement and compare the outputs.

	\begin{enumerate}
		\item 2.0
		\item `2.0'
		\item 2/2
		\item `2/2'
		\item `test'
		\item test
	\end{enumerate}

\item  Using a single line of code with a single print command, output a grammatically correct sentence that answers the following questions (perform the math, if necessary, and output with correct units):

	\begin{enumerate}
		\item What is the number of moles of water in 14.7 g of water?
		\item How many mL are in 1.35 gallons?
		\item What is 72.5 $^{\circ}$F in $^\circ$C?
	\end{enumerate}
    
\end{enumerate}


\subsubsection*{Exercises for Section \ref{Avoiding_repetitive_typing_by_making_your_own_functions}} 
\begin{enumerate}\setcounter{enumi}{14}
	\item  Create functions that do the following tasks:
	\begin{enumerate}
		\item Print the number of moles of water for a given mass of water.  Here, the mass of water should be a \textbf{positional argument}.  Confirm that your function works by reproducing the result of Exercise 14a.
		\item Convert a temperature in degrees Fahrenheit to degrees Celsius and print the result.  Confirm that your function works by reproducing the result of Exercise 14c.
		\item  Solve dilution problems ($M_1V_1 = M_2V_2$) for $M_1$.  Show two examples that prove that it works correctly.
		\item  Solve dilution problems  ($M_1V_1 = M_2V_2$) for $V_1$.  Show two examples that prove that it works correctly.
	\end{enumerate}

\end{enumerate}
\subsection*{Comprehensive exercises} 
\begin{enumerate}\setcounter{enumi}{15}
	\item  Write a function that will take two masses of samples of water and compute the difference in the \textit{number} of molecules of water of the two samples, but rounded to the nearest thousandth of a mole. Write your function so that the order of masses supplied as arguments to the function does not matter.

	\item  You have a spectroscopic detector that you need to cool to 6 K using liquid He. You know the heat capacity of the detector is $105 J kg^{-1} K^{-1}$. Write a function that will take the current (room) temperature of the detector and print the number of liters of liquid He it will take to cool down the detector, rounded to the nearest tenth of a liter. Assume that it requires 5L to simply cool down the transfer line, before you start cooling the detector. Also, print a statement that converts the function's output to a cost in dollars to cool down the detector, rounded to the nearest dollar. At the time of this writing, the cost of liquid helium is \$40/L. Make this the default value, but write the function so that the user can specify any price.
\end{enumerate}
\end{footnotesize} 
