day1quiz1.tex
author Shantanu <shantanu@fossee.in>
Tue, 24 Nov 2009 11:00:52 +0530
changeset 326 f57f42861770
parent 306 57291186d598
child 334 2214b5dba4d4
permissions -rw-r--r--
Cheat sheet for session 2 day 2.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
     2
% Quiz slides day 1 quiz 1
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     3
%
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     4
% Author: FOSSEE <info at fossee  dot in>
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     5
% Copyright (c) 2005-2009, FOSSEE Team
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     8
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     9
\documentclass[14pt,compress]{beamer}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    10
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    11
\mode<presentation>
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    12
{
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
  \useoutertheme{split}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    14
  \setbeamercovered{transparent}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
\definecolor{darkgreen}{rgb}{0,0.5,0}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    18
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
\usepackage{listings}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
\lstset{language=Python,
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
    basicstyle=\ttfamily\bfseries,
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
    commentstyle=\color{red}\itshape,
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
  stringstyle=\color{darkgreen},
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    24
  showstringspaces=false,
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
  keywordstyle=\color{blue}\bfseries}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
% Macros
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
\newcounter{qno}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
\setcounter{qno}{0}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
% Title page
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    38
\title[Basic Python]{Python for science and engineering: Day 1, Quiz 1}
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
\author[FOSSEE Team] {FOSSEE}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    43
\date[] {\today \\Day 1, Quiz 1}
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
\begin{document}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
\begin{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
  \titlepage
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    52
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
\begin{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    54
  \frametitle{Write your details...}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    55
On the top right hand corner please write down the following:
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    56
  \begin{itemize}
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    57
    \item Name:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    58
    \item University/College/Company:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    59
    \item Student/Teacher/Professional:
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
  \end{itemize}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    62
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    63
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    64
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    65
Describe the plot produced by the following:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    66
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    67
\begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    68
In []: x = linspace(0, 2*pi)
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    69
In []: plot(x, cos(x), 'go')
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    70
\end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    71
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    72
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    73
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    74
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    75
How will you plot the previous graph with line width set to 3?  How will
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    76
you set the $x$ and $y$ labels of the plot?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    77
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    78
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    79
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    80
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    81
How will you set the x and y axis limits so that the region of interest
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    82
is in the rectangle $(0, -1.5)$ (left bottom coordinate) and $(2\pi,
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    83
1.5)$ (right top coordinate)?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    84
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    85
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    86
\begin{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    87
\frametitle{\incqno }
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    88
  A sample line from a Comma Separated Values (CSV) file:\\
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    89
  \vspace*{0.2in}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    90
  \emph{Rossum, Guido, 42, 56, 34, 54}\\
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    91
  \vspace*{0.2in}
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    92
  What code would you use to separate the line into fields?
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    93
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    94
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    95
\begin{frame}[fragile]
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    96
\frametitle{\incqno }
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    97
  \begin{lstlisting}
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    98
  In []: a = [1, 2, 5, 9]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
    99
  In []: a[0:-1]
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   100
  \end{lstlisting}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   101
  What is the output?
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   102
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   103
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   104
\begin{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   105
\frametitle{\incqno }
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   106
  How do you combine two lists \emph{a} and \emph{b} to produce one list?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   107
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   108
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   109
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   110
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   111
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   112
  In []: a = [1, 2, 5, 9]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   113
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   114
  How do you add the value 10 to the end of this list?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   115
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   116
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   117
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   118
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   119
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   120
  In []: a = [1, 2, 5, 9]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   121
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   122
  How do you find the length of this list?
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   123
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   124
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   125
\begin{frame}[fragile]
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   126
\frametitle{\incqno }
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   127
  \begin{lstlisting}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   128
  In [1]: d = {
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   129
          'a': 1,
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   130
          'b': 2
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   131
          }
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   132
  In [2]: print d['c']
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   133
  \end{lstlisting}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   134
  What is the output?
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   135
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   136
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   137
%% \begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   138
%% \frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   139
%%   \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   140
%%   for x in "abcd":
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   141
%%       print x
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   142
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   143
%%   a
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   144
%%   b
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   145
%%   c
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   146
%%   d
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   147
%%   \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   148
%%   How do you get the following output? 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   149
%%   \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   150
%%     0 a
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   151
%%     1 b
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   152
%%     2 c
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   153
%%     3 d
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   154
%%   \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   155
%% \end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   156
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   157
\begin{frame}[fragile]
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   158
\frametitle{\incqno }
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   159
\begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   160
In []: sc = {'A': 10, 'B': 20, 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   161
             'C': 70}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   162
\end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   163
Given the above dictionary, what command will you give to plot a
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   164
pie-chart?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   165
\end{frame}
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   166
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   167
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   168
\begin{frame}[fragile]
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   169
\frametitle{\incqno }
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   170
\begin{lstlisting}
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   171
In []: marks = [10, 20, 30, 50, 55, 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   172
                75, 83] 
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   173
\end{lstlisting}
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   174
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   175
Given the above marks, how will you calculate the \alert{mean} and
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   176
\alert{standard deviation}?
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   177
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   178
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   179
%\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   180
%\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   181
%\begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   182
%In []: marks = [10, 20, 30, 50, 55, 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   183
%                75, 83] 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   184
%\end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   185
%How will you convert the list \texttt{marks} to an \alert{array}?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   186
%\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   187
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   188
%% \begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   189
%% \frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   190
%% \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   191
%% In []: a = array([[1, 2],
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   192
%%                   [3, 4]])
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   193
%% In []: a[1,0] = 0
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   194
%% \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   195
%% What is the resulting matrix?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   196
%% \end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   197
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   198
%% \begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   199
%% \frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   200
%% \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   201
%% In []: a = array([[1, 2],
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   202
%%                   [3, 4]])
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   203
%% \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   204
%% How do you get the transpose of this array?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   205
%% \end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   206
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   207
%% \begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   208
%% \frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   209
%% \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   210
%% In []: a = array([[1, 2],
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   211
%%                   [3, 4]])
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   212
%% In []: b = array([[1, 1],
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   213
%%                   [2, 2]])
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   214
%% In []: a*b
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   215
%% \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   216
%% What does this produce?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   217
%% \end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   218
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   219
%% \begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   220
%% \frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   221
%% What command do you use to find the inverse of a matrix and its
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   222
%% eigenvalues?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   223
%% \end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   224
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   225
%% \begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   226
%% \frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   227
%% Given a 4x4 matrix \texttt{A} and a 4-vector \texttt{b}, what command do
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   228
%% you use to solve for the equation \\
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   229
%% \texttt{Ax = b}?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   230
%% \end{frame}
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   231
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   232
\begin{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   233
\frametitle{\incqno }
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 263
diff changeset
   234
Write the code to read a file \texttt{data.txt} and print each line of it?
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   235
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   236
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 261
diff changeset
   237
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   238
\end{document}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   239