1 quiz, seesion5 plots, added links to reference.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tutorial slides on Python.
%
% Author: FOSSEE <info at fossee dot in>
% Copyright (c) 2005-2009, FOSSEE Team
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[14pt,compress]{beamer}
\mode<presentation>
{
\useoutertheme{split}
\setbeamercovered{transparent}
}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\usepackage{listings}
\lstset{language=Python,
basicstyle=\ttfamily\bfseries,
commentstyle=\color{red}\itshape,
stringstyle=\color{darkgreen},
showstringspaces=false,
keywordstyle=\color{blue}\bfseries}
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros
\newcounter{qno}
\setcounter{qno}{0}
\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
\title[Basic Python]{Python: Quiz}
\author[FOSSEE Team] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
\date[] {11, October 2009\\Day 2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Write your details...}
On the top right hand corner please write down the following:
\begin{itemize}
\item Name:
\item Affliation:
\item Occupation:
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
>>> x = array([[1,2,3,4],[3,4,2,5]])
>>> x.shape
(2, 4)
\end{lstlisting}
Change the shape of \lstinline+x+ to (4,2)
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
>>> x = array([[1,2,3,4]])
\end{lstlisting}
How to change the third element of \lstinline+x+ to 0?
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
What would be the result?
\begin{lstlisting}
>>> y = arange(3)
>>> x = linspace(0,3,3)
>>> x-y
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
>>> x = array([0, 1, 2, 3])
>>> x.shape = 2,2
>>> x
array([[0, 1],
[2, 3]])
>>> x[::2,::2]
\end{lstlisting}
What is the output?
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
What would be the result?
\begin{lstlisting}
>>> x
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
>>> x[::-1,:]
\end{lstlisting}
Hint:
\begin{lstlisting}
>>> x = arange(9)
>>> x[::-1]
array([8, 7, 6, 5, 4, 3, 2, 1, 0])
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
>>> x
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])
\end{lstlisting}
How will you get the following \lstinline+x+?
\begin{lstlisting}
array([[ 5, 7],
[ 9, 11]])
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
>>> x = array(([1,2,3,4],[2,3,4,5]))
>>> x[-2][-3] = 4
>>> x
\end{lstlisting}
What will be printed?
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
What would be the output?
\begin{lstlisting}
>>> y = arange(4)
>>> x = array(([1,2,3,2],[1,3,6,0]))
>>> x + y
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
>>> line = plot(x, sin(x))
\end{lstlisting}
Use the \lstinline+set_linewidth+ method to set width of \lstinline+line+ to 2.
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
What would be the output?
\begin{lstlisting}
>>> x = arange(9)
>>> y = arange(9.)
>>> x == y
\end{lstlisting}
\end{frame}
\end{document}