\documentclass[10pt]{book}
\usepackage{fullpage, graphicx, url}
\usepackage{makeidx}
\usepackage{fancyvrb}
\usepackage{moreverb}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\usepackage{setspace}
\usepackage{palatino}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0ex}
\title{COMP150: Practical Programming (in Python)}
\author{Jeffrey Elkner \and Allen B. Downey \and Chris Meyers
\and Brendan McCane \and Iain Hewson \and Nick Meek}

\newcommand{\myidx}[1]{\textbf{#1}\index{#1}}
\newcommand{\myurl}[1]{\texttt{#1}}
\newcommand{\submitreminder}
{\subsection*{Remember to submit a folder containing the files you
  created during this lab.}
}

\renewcommand{\chaptername}{Lecture }

\newcommand{\menu}[1]{\emph{#1}}
%  \newcommand{\brenNote}[1]{\textbf{BrenNote: } {\it #1}}
%  \newcommand{\nickNote}[1]{\textbf{#1}}
%  \newcommand{\iain}[1]{\textbf{Iain Note: } {\it #1}}
\newcommand{\brenNote}[1]{}
\newcommand{\nickNote}[1]{}
\newcommand{\iain}[1]{}
\newcommand{\rarr}{$\rightarrow$}

\renewcommand{\lstlistlistingname}{Code Listings}
\renewcommand{\lstlistingname}{Code Listing}

% \definecolor{gray}{gray}{0.5}
\definecolor{green}{rgb}{0,0.5,0}

\definecolor{gray1}{gray}{0.1}
\definecolor{gray2}{gray}{0.2}
\definecolor{gray3}{gray}{0.3}
\definecolor{gray4}{gray}{0.4}
\definecolor{gray5}{gray}{0.5}
\definecolor{gray6}{gray}{0.6}
\definecolor{gray7}{gray}{0.7}
\definecolor{gray8}{gray}{0.8}
\definecolor{gray9}{gray}{0.9}

% a python code environment
\newcommand{\pythonlstset}[1]{
\lstset{
language=python,
basicstyle=\ttfamily\small\setstretch{1},
stringstyle=\color{gray1},
showstringspaces=false,
alsoletter={1234567890},
otherkeywords={\ , \}, \{},
keywordstyle=\color{black},
emph={access,and,break,class,continue,def,del,elif,else,%
except,exec,finally,for,from,global,if,import,in,is,%
lambda,not,or,pass,print,raise,return,try,while},
emphstyle=\color{black}\bfseries,
emph={[2]True, False, None, self},
emphstyle=[2]\color{black},
emph={[3]from, import, as},
emphstyle=[3]\color{black},
upquote=true,
morecomment=[s]{"""}{"""},
commentstyle=\color{gray1}\slshape,
emph={[4]1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
emphstyle=[4]\color{black},
literate=*{:}{{\textcolor{black}:}}{1}%
	{=}{{\textcolor{black}=}}{1}%
	{-}{{\textcolor{black}-}}{1}%
	{+}{{\textcolor{black}+}}{1}%
	{*}{{\textcolor{black}*}}{1}%
	{!}{{\textcolor{black}!}}{1}%
	{(}{{\textcolor{black}(}}{1}%
	{)}{{\textcolor{black})}}{1}%
	{[}{{\textcolor{black}[}}{1}%
	{]}{{\textcolor{black}]}}{1}%
	{<}{{\textcolor{black}<}}{1}%
	{>}{{\textcolor{black}>}}{1},%
framexleftmargin=1mm, framextopmargin=1mm, frame=shadowbox,
rulesepcolor=\color{gray7},#1
}}

\lstnewenvironment{python}[1][]{
\pythonlstset{#1}
}{}

\lstnewenvironment{shell}[1][]{\lstset{
basicstyle=\ttfamily\small,frame=shadowbox,
framexleftmargin=1mm,framextopmargin=1mm,
rulesepcolor=\color{gray5},
#1}}{}

\lstnewenvironment{pythonInteractive}[1][]{\lstset{
basicstyle=\ttfamily\small,frame=shadowbox,
framexleftmargin=1mm,framextopmargin=1mm,
rulesepcolor=\color{gray5},
#1}}{}

\lstnewenvironment{pythonOutput}[1][]{
\lstset{
basicstyle=\ttfamily\small,frame=shadowbox,
framexleftmargin=1mm,framextopmargin=1mm,
rulesepcolor=\color{gray3},
backgroundcolor=\color{gray9},
#1}}{}

\newcommand{\pythoninline}[1]{\texttt{#1}}

\newcommand{\answerspacestyle}[1]{
\lstset{
basicstyle=\ttfamily\thicklines,
columns=flexible,
aboveskip=5mm,
belowskip=3mm,
xleftmargin=6mm,
xrightmargin=6mm,
frame=single,
framesep=3mm,
rulecolor=\color{gray7},
frameround=tttt,
emph={zend},
emphstyle=\color{white},
#1
}}

% Use the answerspace environment as shown below to get a three line
% space to write an answer.  Note that the `zend' at the end gets
% whited-out, but any other text you put in (e.g. numbers) won't be.
% You should always have a `zend' to get enough space for an answer
%
%\begin{answerspace}
%
%
%zend
%\end{answerspace}
\lstnewenvironment{answerspace}[1][]{\answerspacestyle{#1}}{}

\makeindex

% \includeonly{gui_intro,case_study_catch,case_study_catch2,strings,strings2,lists,lists2,tuples,dictionaries,classes_objects,system_programming,classes_objects,case_study_2,last_lecture}

\begin{document}

\include{frontmatter}

\mainmatter

\include{way_of_program}

\include{variables}

\include{built_ins}

\include{functions}

\include{functions2}

\include{conditionals}

\include{fruitful_functions}

\include{test_driven_development}

\include{files_modules}

\include{iteration}

\include{iteration2}

\include{class_test}

\include{gui_intro}

\include{case_study_catch}

\include{case_study_catch2}

\include{strings}

\include{strings2}

\include{lists}

\include{lists2}

\include{tuples}

\include{dictionaries}

\include{system_programming}

\include{classes_objects}

\include{case_study_2}

\include{last_lecture}

\include{extra_extension}

\include{fdl-1.2}

\printindex

\end{document}
