\documentclass{article}

\usepackage{amsmath}
\usepackage{listings}
\usepackage{framed}
\usepackage{amssymb}
\usepackage{graphicx}

\addtolength{\textwidth}{1in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\textheight}{1in}
\addtolength{\topmargin}{-0.5in}

\begin{document}

\noindent
\centerline{\Large\bf CS:1210 Quiz 9 Version (b)}

\medskip

\medskip
\hrule

\medskip
\noindent
You have 15 minutes to complete this quiz.
Please put away your books, notes, and all electronic devices

\noindent
Suppose that list \texttt{L} equals 
\texttt{[["This", ["is", "a"]], "nested", ["list", "with"],
["several", [["different"]]], ["levels", "of"], "nesting"]}.
Evaluate these list comprehensions. The first 5 parts of worth 1 point each 
and the remaining 5 are worth 2 points each.

\begin{itemize}
\item[(a)] \texttt{[str(x).replace("1", "8") for x in range(101, 111)]}

\vspace{0.45in}

\item[(b)] \texttt{[str(x).split("0") for x in range(105, 111)]}

\vspace{0.45in}

\item[(c)] \texttt{[x[1] for x in L if len(x)\%2 == 0 and type(x) == list]}

\vspace{0.45in}

\item[(d)] \texttt{[list(range(sum(range(x))))[::-1][:2] for x in range(5, 9, 2)]}

\vspace{0.45in}

\item[(e)] \texttt{[x[::-1][1] for x in L[:4]]}

\vspace{0.45in}

\item[(f)] \texttt{[[x for x in range(4)] for y in range(4)]}

\vspace{0.45in}

\item[(g)] \texttt{[y for x in L for y in x if type(x) == list and type(y) == str]}

\vspace{0.45in}

\item[(h)] \texttt{[y for x in [range(z+1) for z in range(4)] for y in x]}

\vspace{0.45in}

\item[(i)] \texttt{[i for i in range(len(L)) if len(L[i]) == i]}

\vspace{0.45in}

\item[(j)] \texttt{[x*y for x in L for y in range(len(x)) if type(x) == str and y < 3]}
\end{itemize}

\end{document}
