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

\subsubsection*{Exercises for Section \ref{Automatically_running_different_code_under_different_conditions_using_if-then-else_statements}} 
\begin{enumerate}\setcounter{enumi}{-1}
	\item  Write three different functions that take as an argument a p$H$ value and print a statement saying whether the value is `strongly acidic', `acidic', `neutral', `basic', or `strongly basic'.  One version can only use \lstinline{if} statements, the second must use nested \lstinline{if-else} statements, and the third must use \lstinline{if-elif-else}.  Prove that they work correctly by testing the values 1.0, 4.0, 7.0, 10.0, and 13.0.

	
	\item  Explain the following joke: "Your roommate is going to the store, so you ask them to pick up a gallon of milk and, if the store has eggs, to get a dozen.  Your roommate returns with a dozen gallons of milk."

	
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Setting_the_working_directory_using_os.chdir}} 
\begin{enumerate}\setcounter{enumi}{1}
	\item  Change your working directory to your downloads folder. Verify using \lstinline{os.pwd()}.

	\item  Using the \lstinline{quickSelectFolder()} function in the codechembook library, write a line of code that will change your directory to one of your choosing. 

	
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Importing_any_Python_code_from_anywhere_on_your_computer}} 
\begin{enumerate}\setcounter{enumi}{3}
	\item  Almost every library you use is (at least in part) just Python code, stored in a .py file.  This is useful because you can learn about things that are not in the documentation by looking at the code itself.  Find the folder where all of your libraries are stored, then find the folder for lmfit and open the 'lineshapes.py' file. On our windows machine, the path is \lstinline{C:\Users\authors\AppData\Roaming\Microsoft\Windows\Recent\lineshapes.py.lnk}, but you can also just search for this file. Explain how the \lstinline{sine()} and \lstinline{gaussian()} functions work.

	
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Handling_errors_without_crashing_using_try-except-finally_}} 
\begin{enumerate}\setcounter{enumi}{4}
	\item  Update the final code from in Chapter 5 to use \lstinline{try-except} to ensure that the user has input a number when asked for the wavelength of the feature of interest.  If the user inputs a value that can not be converted to a float, then the code should handle the error by printing, ``You must enter a number!''

	
	\item  Update the code in Chapter 2 to use \lstinline{try-except} to check to make sure the data file is openable.  If there is an error, inform the user and call \lstinline{quickOpenFilename()} to help them find the right file.  Test your code.

	
\end{enumerate}
\subsection*{Comprehensive exercises} 
\begin{enumerate}\setcounter{enumi}{6}
	\item  Your friend is working up data from an amyloid formation assay using a plate reader and a chromophore that becomes absorptive when in the presence of amyloid. This gives him a set of data that contains absorption at $\lambda_{max}$ versus temperature, which can be used to track the concentration of amyloid. He wants to fit this data to the following modified Sigmoid function and extract $t_{50}$:
    
	\hspace{3em} $[\textrm{amyloid}](t) = (m_1t + b_1)\left(\frac{1}{\exp{\frac{t_{50}-t}{\sigma_1}}}\right)  + (m_2t + b_2)\left(\frac{1}{\exp{\frac{t_{50}-t}{\sigma_2}}}\right)$


	Here, $m_1$ and $b_1$ are the slope and $y$-intercept of the end of the trace, $m_2$ and $b_2$ are the slope and intercept of beginning of the trace, $\sigma_1$ and $\sigma_2$ control the shape of the curved parts of the trace, and $t_{50}$ is the time at which half of the amyloid is formed.
	
	He provides you with a sample data file for a single well to get started. Write a script that reads the data, creates a model for this modified Sigmoid function, sets the initial guesses for the parameters and shows the user the initial model so that the initial guesses can be updated to get close enough for the fit to work. Then, once these guesses are close, call the fitter, plot the results, and print the best fitting value of $t_{50}$.
\end{enumerate}
\end{footnotesize} 
