day1/day1quiz1.tex
author Santosh G. Vattam <vattam.santosh@gmail.com>
Tue, 30 Mar 2010 11:29:26 +0530
changeset 383 26294a5b856b
parent 379 682b6f66fe11
child 384 9f9fddf7e37c
permissions -rw-r--r--
Added new image files needed for compilation.
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
\begin{document}
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{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
  \titlepage
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
\begin{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    52
  \frametitle{Write your details...}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
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
    54
  \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
    55
    \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
    56
    \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
    57
    \item Student/Teacher/Professional:
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
    58
    \item Field of interest/study:
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    59
  \end{itemize}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    62
%% \begin{frame}[fragile]
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    63
%% \frametitle{\incqno }
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    64
%% Draw (roughly) the plot obtained by the following:
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    65
%% \begin{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    66
%% In []: x = linspace(0, 2*pi, 3)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    67
%% In []: plot(x, sin(x))
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    68
%% \end{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    69
%% \end{frame}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    70
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    71
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    72
\frametitle{\incqno }
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    73
Describe the plot produced by the following:
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    74
\begin{lstlisting}
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    75
In []: x = linspace(0, 2*pi, 50)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    76
In []: plot(x, cos(x), 'go')
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    77
\end{lstlisting}
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 372
diff changeset
    78
Note: Do not draw it, just describe the plot
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    79
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    80
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    81
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    82
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    83
How will you plot the previous graph with line width set to 3?  How will
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    84
you set the $x$ and $y$ labels of the plot?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    85
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    86
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    87
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    88
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    89
How will you set the x and y axis limits so that the region of interest
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    90
is in the rectangle $(0, -1.5)$ (left bottom coordinate) and $(2\pi,
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    91
1.5)$ (right top coordinate)?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    92
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    93
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    94
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    95
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    96
What ipython magic command do you use to obtain the lines of code you have already typed in the interpreter? What command do you use to save them?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    97
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    98
372
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
    99
%% \begin{frame}[fragile]
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   100
%% \frametitle{\incqno }
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   101
%% The following code snippet has an error/bug:
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   102
%% \begin{lstlisting}
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   103
%% In []: y = linspace(0, 2*pi, 50)
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   104
%% In []: plot(y, sin(y))
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   105
%% In []: clf()
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   106
%% In []: plot(y, cos(y))
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   107
%% In []: legend(['sin(y)', 'cos(y)']) 
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   108
%% \end{lstlisting}
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   109
%% What is the error? How do you fix it?  
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   110
%% \end{frame}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   111
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   112
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   113
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   114
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   115
  In []: a = [1, 2, 5, 9]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   116
  In []: a[0:-1]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   117
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   118
  What is the output?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   119
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   120
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   121
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   122
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   123
  How do you combine two lists \emph{a} and \emph{b} to produce one list?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   124
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   125
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   126
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   127
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   128
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   129
  In []: a = [1, 2, 5, 9]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   130
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   131
  How do you add the value 10 to the end of this list?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   132
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   133
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   134
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   135
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   136
Write the code to read a file \texttt{data.txt} and print each line of it?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   137
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   138
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   139
%% \begin{frame}[fragile]
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   140
%% \frametitle{\incqno }
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   141
%% What would be the result of the following code snippet:
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   142
%% \begin{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   143
%% In []: x = linspace(0, 10, 50)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   144
%% In []: y = linspace(50, 100, 100)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   145
%% In []: plot(x, y)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   146
%% \end{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   147
%% \end{frame}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   148
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   149
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   150
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   151
The following code snippet has an error/bug:
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   152
\begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   153
In []: l = [0.1, 0.2, 0.3, 0.4]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   154
In []: t = [0.69, 0.90, 1.19, 1.30]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   155
In []: tsq = []
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   156
In []: for time in t:
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   157
 ....:     tsq.append(time*time)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   158
 ....:     plot(l, tsq)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   159
\end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   160
What is the error? How do you fix it?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   161
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   162
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   163
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   164
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   165
  A sample line from a Comma Separated Values (CSV) file:\\
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   166
  \vspace*{0.2in}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   167
  \emph{Rossum, Guido, 42, 56, 34, 54}\\
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   168
  \vspace*{0.2in}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   169
  What code would you use to separate the line into fields?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   170
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   171
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   172
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   173
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   174
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   175
  In []: a = [1, 2, 5, 9]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   176
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   177
  How do you find the length of this list?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   178
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   179
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   180
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   181
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   182
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   183
  In [1]: d = {
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   184
          'a': 1,
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   185
          'b': 2
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   186
          }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   187
  In [2]: print d['c']
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   188
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   189
  What is the output?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   190
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   191
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   192
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   193
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   194
\begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   195
In []: sc = {'A': 10, 'B': 20, 
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   196
             'C': 70}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   197
\end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   198
Given the above dictionary, what command will you give to plot a
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   199
pie-chart?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   200
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   201
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   202
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   203
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   204
\begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   205
In []: marks = [10, 20, 30, 50, 55, 
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   206
                75, 83] 
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   207
\end{lstlisting}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   208
Given the above marks, how will you calculate the \alert{mean}?%%  and
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   209
%% \alert{standard deviation}?
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   210
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   211
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   212
%% \begin{frame}[fragile]
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   213
%% \frametitle{\incqno }
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   214
%% \begin{lstlisting}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   215
%% In []: marks = [10, 20, 30, 50, 55, 
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   216
%%                 75, 83] 
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   217
%% \end{lstlisting}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   218
%% How will you convert the list \texttt{marks} to an \alert{array}?
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 373
diff changeset
   219
%% \end{frame}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   220
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   221
\end{document}