diff options
author | Shantanu Choudhary | 2009-10-31 01:33:12 +0530 |
---|---|---|
committer | Shantanu Choudhary | 2009-10-31 01:33:12 +0530 |
commit | cb18959fe1554c4cd8bcc2af160c14af5010f70a (patch) | |
tree | 54141e7718f5682c02ffe53c352ceb575f2f3434 /day1quiz2.tex | |
parent | da363caede7e7f4fbdf50218e46432a94b8555c0 (diff) | |
download | workshops-cb18959fe1554c4cd8bcc2af160c14af5010f70a.tar.gz workshops-cb18959fe1554c4cd8bcc2af160c14af5010f70a.tar.bz2 workshops-cb18959fe1554c4cd8bcc2af160c14af5010f70a.zip |
1 quiz, seesion5 plots, added links to reference.
Diffstat (limited to 'day1quiz2.tex')
-rw-r--r-- | day1quiz2.tex | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/day1quiz2.tex b/day1quiz2.tex new file mode 100644 index 0000000..7b65c87 --- /dev/null +++ b/day1quiz2.tex @@ -0,0 +1,178 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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} + |