Updated the quiz tex files of both day 1 and day 2.
--- a/day1quiz1.tex Wed Nov 11 15:38:50 2009 +0530
+++ b/day1quiz1.tex Wed Nov 11 17:08:32 2009 +0530
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Tutorial slides on Python.
+% Quiz slides day 1 quiz 1
%
% Author: FOSSEE <info at fossee dot in>
% Copyright (c) 2005-2009, FOSSEE Team
@@ -35,12 +35,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
-\title[Basic Python]{Python: Quiz}
+\title[Basic Python]{Python for science and engineering: Day 1, Quiz 1}
\author[FOSSEE Team] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {31, October 2009\\Day 1, Quiz 1}
+\date[] {\today \\Day 1, Quiz 1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -54,33 +54,72 @@
\frametitle{Write your details...}
On the top right hand corner please write down the following:
\begin{itemize}
- \item Name:
- \item Affliation:
- \item Occupation:
+ \item Name:
+ \item University/College/Company:
+ \item Student/Teacher/Professional:
\end{itemize}
\end{frame}
+\begin{frame}[fragile]
+\frametitle{\incqno }
+Describe the plot produced by the following:
+
+\begin{lstlisting}
+In []: x = linspace(0, 2*pi)
+In []: plot(x, cos(x), 'go')
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How will you plot the previous graph with line width set to 3? How will
+you set the $x$ and $y$ labels of the plot?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How will you set the x and y axis limits so that the region of interest
+is in the rectangle $(0, -1.5)$ (left bottom coordinate) and $(2\pi,
+1.5)$ (right top coordinate)?
+\end{frame}
+
\begin{frame}
\frametitle{\incqno }
A sample line from a Comma Separated Values (CSV) file:\\
\vspace*{0.2in}
\emph{Rossum, Guido, 42, 56, 34, 54}\\
\vspace*{0.2in}
- What method would you use to separate the line into fields?
+ What code would you use to separate the line into fields?
\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
- In [1]: a = [1, 2, 5, 9]
- In [2]: a[:-1]
+ In []: a = [1, 2, 5, 9]
+ In []: a[0:-1]
\end{lstlisting}
What is the output?
\end{frame}
\begin{frame}
\frametitle{\incqno }
- How do you combine the two lists \emph{a} and \emph{b}?
+ How do you combine two lists \emph{a} and \emph{b} to produce one list?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In []: a = [1, 2, 5, 9]
+ \end{lstlisting}
+ How do you add the value 10 to the end of this list?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In []: a = [1, 2, 5, 9]
+ \end{lstlisting}
+ How do you find the length of this list?
\end{frame}
\begin{frame}[fragile]
@@ -95,66 +134,106 @@
What is the output?
\end{frame}
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% for x in "abcd":
+%% print x
+
+%% a
+%% b
+%% c
+%% d
+%% \end{lstlisting}
+%% How do you get the following output?
+%% \begin{lstlisting}
+%% 0 a
+%% 1 b
+%% 2 c
+%% 3 d
+%% \end{lstlisting}
+%% \end{frame}
+
\begin{frame}[fragile]
\frametitle{\incqno }
- \begin{lstlisting}
- for x in "abcd":
- print x
+\begin{lstlisting}
+In []: sc = {'A': 10, 'B': 20,
+ 'C': 70}
+\end{lstlisting}
+Given the above dictionary, what command will you give to plot a
+pie-chart?
+\end{frame}
- a
- b
- c
- d
- \end{lstlisting}
- How do you get the following output?
- \begin{lstlisting}
- 0 a
- 1 b
- 2 c
- 3 d
- \end{lstlisting}
-\end{frame}
\begin{frame}[fragile]
\frametitle{\incqno }
-What would be the result?
\begin{lstlisting}
- In [1]: x
- array([[0, 1, 2],
- [3, 4, 5],
- [6, 7, 8]])
- In [2]: x[::-1,:]
+In []: marks = [10, 20, 30, 50, 55,
+ 75, 83]
\end{lstlisting}
+
+Given the above marks, how will you calculate the \alert{mean} and
+\alert{standard deviation}?
\end{frame}
-\begin{frame}
-\frametitle{\incqno }
-How to read and print each line of a file.
-\end{frame}
+%\begin{frame}[fragile]
+%\frametitle{\incqno }
+%\begin{lstlisting}
+%In []: marks = [10, 20, 30, 50, 55,
+% 75, 83]
+%\end{lstlisting}
+%How will you convert the list \texttt{marks} to an \alert{array}?
+%\end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: a = array([[1, 2],
+%% [3, 4]])
+%% In []: a[1,0] = 0
+%% \end{lstlisting}
+%% What is the resulting matrix?
+%% \end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: a = array([[1, 2],
+%% [3, 4]])
+%% \end{lstlisting}
+%% How do you get the transpose of this array?
+%% \end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: a = array([[1, 2],
+%% [3, 4]])
+%% In []: b = array([[1, 1],
+%% [2, 2]])
+%% In []: a*b
+%% \end{lstlisting}
+%% What does this produce?
+%% \end{frame}
+
+%% \begin{frame}
+%% \frametitle{\incqno }
+%% What command do you use to find the inverse of a matrix and its
+%% eigenvalues?
+%% \end{frame}
+
+%% \begin{frame}
+%% \frametitle{\incqno }
+%% Given a 4x4 matrix \texttt{A} and a 4-vector \texttt{b}, what command do
+%% you use to solve for the equation \\
+%% \texttt{Ax = b}?
+%% \end{frame}
\begin{frame}
\frametitle{\incqno }
-How to get list of third column of a data file.
+Write the code to read a file \texttt{data.txt} and print each line of it?
\end{frame}
-\begin{frame}[fragile]
-\frametitle{\incqno }
-What is the output of:
-\begin{lstlisting}
-In []: x=linspace(0 , 2 * pi)
-In []: plot(x, cos(x),'go')
-\end{lstlisting}
-\end{frame}
-
-\begin{frame}
-\frametitle{\incqno }
-Draw a plot with line width 3.
-\end{frame}
-
-\begin{frame}
-\frametitle{\incqno }
-Setting x and y axis limits.
-\end{frame}
\end{document}
--- a/day1quiz2.tex Wed Nov 11 15:38:50 2009 +0530
+++ b/day1quiz2.tex Wed Nov 11 17:08:32 2009 +0530
@@ -35,12 +35,13 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
-\title[Basic Python]{Python: Quiz}
+\title[Basic Python]{Python for science and engineering: Day 1, Quiz 2}
\author[FOSSEE Team] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {11, October 2009\\Day 2}
+\date[] {\today \\
+Day 1, quiz 2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -54,125 +55,243 @@
\frametitle{Write your details...}
On the top right hand corner please write down the following:
\begin{itemize}
- \item Name:
- \item Affliation:
- \item Occupation:
+ \item Name:
+ \item University/College/Company:
+ \item Student/Teacher/Professional:
\end{itemize}
\end{frame}
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: x = array([[1,2,3,4],
+%% [3,4,2,5]])
+%% \end{lstlisting}
+%% What is the \lstinline+shape+ of this array?
+%% \end{frame}
+
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ In []: x = array([[1,2,3,4]])
+\end{lstlisting}
+How to change the third element (i.e.\ 3) of \lstinline+x+ to 0?
+\end{frame}
+
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
- >>> x = array([[1,2,3,4],[3,4,2,5]])
- >>> x.shape
- (2, 4)
+ In []: x = array([[1,2,3,4],
+ [3,4,2,5]])
+\end{lstlisting}
+How do you get the following slice of \lstinline+x+?
+\begin{lstlisting}
+array([[2,3],
+ [4,2]])
\end{lstlisting}
-Change the shape of \lstinline+x+ to (4,2)
\end{frame}
+
+%% \begin{frame}
+%% \frametitle{\incqno }
+%% The file \lstinline+datafile.txt+ contains 3 columns of data. What
+%% command will you use to read the entire data file into an array?
+%% \end{frame}
+
+%% \begin{frame}
+%% \frametitle{\incqno }
+
+%% If the contents of the file \lstinline+datafile.txt+ is read into an
+%% $N\times3$ array called \lstinline+data+, how would you obtain the third
+%% column of this data?
+
+%% \end{frame}
+
\begin{frame}[fragile]
\frametitle{\incqno }
\begin{lstlisting}
- >>> x = array([[1,2,3,4]])
+ In []: x = array(([1,2,3,4],
+ [2,3,4,5]))
+ In []: x[-2][-3] = 4
+ In []: print x
\end{lstlisting}
-How to change the third element of \lstinline+x+ to 0?
+What will be printed?
\end{frame}
-\begin{frame}[fragile]
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: x = arange(0, 1, 0.25)
+%% In []: print x
+%% \end{lstlisting}
+%% What will be printed?
+%% \end{frame}
+
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% from scipy.integrate import quad
+%% def f(x):
+%% res = x*cos(x)
+
+%% quad(f, 0, 1)
+%% \end{lstlisting}
+
+%% What changes will you make to the above code to make it work?
+%% \end{frame}
+
+%% \begin{frame}
+%% \frametitle{\incqno }
+%% What two commands will you use to create and evaluate a spline given
+%% some data?
+%% \end{frame}
+
+\begin{frame}
\frametitle{\incqno }
-What would be the result?
-\begin{lstlisting}
- >>> y = arange(3)
- >>> x = linspace(0,3,3)
- >>> x-y
-\end{lstlisting}
+What command will you use if you wish to integrate a system of ODEs?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How do you calculate the roots of the polynomial, $y = 1 + 6x + 8x^2 +
+x^3$?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+
+Two arrays \lstinline+a+ and \lstinline+b+ are numerically almost equal, what command
+do you use to check if this is true?
+
\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]
+In []: marks = [10, 20, 30, 50, 55,
+ 75, 83]
\end{lstlisting}
-What is the output?
+How will you convert the list \texttt{marks} to an \alert{array}?
\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,:]
+In []: a = array([[1, 2],
+ [3, 4]])
+In []: a[1,0] = 0
\end{lstlisting}
-Hint:
+What is the resulting matrix?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
\begin{lstlisting}
- >>> x = arange(9)
- >>> x[::-1]
- array([8, 7, 6, 5, 4, 3, 2, 1, 0])
+In []: a = array([[1, 2],
+ [3, 4]])
\end{lstlisting}
+How do you get the transpose of this array?
\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]])
+In []: a = array([[1, 2],
+ [3, 4]])
+In []: b = array([[1, 1],
+ [2, 2]])
+In []: a*b
\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?
+What does this produce?
\end{frame}
-\begin{frame}[fragile]
+\begin{frame}
\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}
+What command do you use to find the inverse of a matrix and its
+eigenvalues?
\end{frame}
-\begin{frame}[fragile]
+\begin{frame}
\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.
+Given a 4x4 matrix \texttt{A} and a 4-vector \texttt{b}, what command do
+you use to solve for the equation \\
+\texttt{Ax = b}?
\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}
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% What would be the result?
+%% \begin{lstlisting}
+%% In []: x
+%% array([[0, 1, 2],
+%% [3, 4, 5],
+%% [6, 7, 8]])
+%% In []: x[::-1,:]
+%% \end{lstlisting}
+%% Hint:
+%% \begin{lstlisting}
+%% In []: x = arange(9)
+%% In []: x[::-1]
+%% array([8, 7, 6, 5, 4, 3, 2, 1, 0])
+%% \end{lstlisting}
+%% \end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% What would be the result?
+%% \begin{lstlisting}
+%% In []: y = arange(3)
+%% In []: x = linspace(0,3,3)
+%% In []: x-y
+%% \end{lstlisting}
+%% \end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: 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 }
+%% What would be the output?
+%% \begin{lstlisting}
+%% In []: y = arange(4)
+%% In []: x = array(([1,2,3,2],[1,3,6,0]))
+%% In []: x + y
+%% \end{lstlisting}
+%% \end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: 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}
+%% In []: x = arange(9)
+%% In []: y = arange(9.)
+%% In []: x == y
+%% \end{lstlisting}
+%% \end{frame}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/day2quiz.tex Wed Nov 11 17:08:32 2009 +0530
@@ -0,0 +1,229 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Quiz slides day 1 quiz 1
+%
+% 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 for science and engineering: Day 2, Quiz 1}
+
+\author[FOSSEE Team] {FOSSEE}
+
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\date[] {\today \\ Day 2, Quiz 1}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\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 University/College/Company:
+ \item Student/Teacher/Professional:
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}
+\frametitle{\incqno }
+ What is the largest integer value that can be represented natively by Python?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ What is the result of 17.0 / 2?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ Which of the following is not a type in Python?
+ \begin{enumerate}
+ \item int
+ \item float
+ \item char
+ \item string
+ \end{enumerate}
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How do you create a complex number with real part 2 and imaginary part
+0.5.
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ What happens when we run this code?
+ \begin{lstlisting}
+a = False
+b = True
+c = True
+if a and b or c:
+ print "You are correct!"
+ \end{lstlisting}
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ What is the difference between \kwrd{print} \emph{x} and \kwrd{print} \emph{x,} ?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ What does '*' * 40 produce?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ What is the output of:
+ \begin{lstlisting}
+In []: ', '.join(['a', 'b', 'c'])
+ \end{lstlisting}
+\end{frame}
+
+\begin{frame}
+ \frametitle{\incqno}
+ How do you find the presence of an element \emph{x} in the list \emph{a}?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: set([1, 2, 8, 2, 13, 8, 9])
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: 47%3
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = 12
+In []: a *= 1+1
+ \end{lstlisting}
+ What is the value of a?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = {'a': 1, 'b': 2}
+In []: a['a'] = 10
+In []: print a
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: for i in range(3, 10, 2):
+ ...: print i
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = [1, 2, 3]
+In []: a.extend([5, 6])
+ \end{lstlisting}
+ What is the value of a?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = (1, 2, 3)
+In []: a[1] = 10
+ \end{lstlisting}
+ What is the result?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+def func(x, y=10):
+ print x+1, y+10
+
+func(1)
+
+ \end{lstlisting}
+
+ What is the output?
+\end{frame}
+
+\begin{frame}
+ \frametitle{\incqno}
+ How many items can a function return?
+\end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno}
+%% Consider a module called \lstinline+gcd.py+ looking like this:
+%% \begin{lstlisting}
+%% def gcd(a, b):
+%% ...
+
+%% if __name__ == '__main__':
+%% print gcd(10, 25)
+%% \end{lstlisting}
+%% If this module is imported, will it print the gcd of 10 and 25?
+%% \end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno}
+%% \begin{lstlisting}
+%% In [1]: print hello
+%% \end{lstlisting}
+%% Exactly what exception will you get if you run this on a fresh
+%% interpreter?
+%% \end{frame}
+
+\end{document}
+
--- a/day2quiz2.tex Wed Nov 11 15:38:50 2009 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% 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}
-
--- a/quiz-day2.tex Wed Nov 11 15:38:50 2009 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% 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}
-