day1/day1quiz1.tex
author Santosh G. Vattam <vattam.santosh@gmail.com>
Tue, 02 Mar 2010 10:55:49 +0530
changeset 374 0ba81871dae5
parent 373 f04eca8b2f3d
child 379 682b6f66fe11
permissions -rw-r--r--
Branches merged.
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:
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    58
  \end{itemize}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    59
\end{frame}
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    61
%% \begin{frame}[fragile]
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    62
%% \frametitle{\incqno }
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    63
%% 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
    64
%% \begin{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    65
%% In []: x = linspace(0, 2*pi, 3)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    66
%% In []: plot(x, sin(x))
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    67
%% \end{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    68
%% \end{frame}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    69
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    70
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    71
\frametitle{\incqno }
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    72
Describe the plot produced by the following:
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    73
\begin{lstlisting}
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    74
In []: x = linspace(0, 2*pi, 50)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
    75
In []: plot(x, cos(x), 'go')
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    76
\end{lstlisting}
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 372
diff changeset
    77
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
    78
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    79
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    80
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    81
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    82
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
    83
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
    84
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    85
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    86
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    87
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    88
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
    89
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
    90
1.5)$ (right top coordinate)?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    91
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    92
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    93
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    94
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    95
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
    96
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
    97
372
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
    98
%% \begin{frame}[fragile]
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
    99
%% \frametitle{\incqno }
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   100
%% The following code snippet has an error/bug:
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   101
%% \begin{lstlisting}
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   102
%% In []: y = linspace(0, 2*pi, 50)
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   103
%% In []: plot(y, sin(y))
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   104
%% In []: clf()
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   105
%% In []: plot(y, cos(y))
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   106
%% In []: legend(['sin(y)', 'cos(y)']) 
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   107
%% \end{lstlisting}
5f02dfb93df1 Minor edits to day1quiz1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 371
diff changeset
   108
%% 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
   109
%% \end{frame}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   110
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   111
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   112
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   113
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   114
  In []: a = [1, 2, 5, 9]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   115
  In []: a[0:-1]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   116
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   117
  What is the output?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   118
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   119
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   120
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   121
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   122
  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
   123
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   124
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   125
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   126
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   127
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   128
  In []: a = [1, 2, 5, 9]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   129
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   130
  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
   131
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   132
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   133
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   134
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   135
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
   136
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   137
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   138
%% \begin{frame}[fragile]
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   139
%% \frametitle{\incqno }
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   140
%% 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
   141
%% \begin{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   142
%% In []: x = linspace(0, 10, 50)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   143
%% In []: y = linspace(50, 100, 100)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   144
%% In []: plot(x, y)
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   145
%% \end{lstlisting}
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   146
%% \end{frame}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   147
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   148
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   149
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   150
The following code snippet has an error/bug:
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   151
\begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   152
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
   153
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
   154
In []: tsq = []
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   155
In []: for time in t:
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   156
 ....:     tsq.append(time*time)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   157
 ....:     plot(l, tsq)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   158
\end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   159
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
   160
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   161
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   162
\begin{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   163
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   164
  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
   165
  \vspace*{0.2in}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   166
  \emph{Rossum, Guido, 42, 56, 34, 54}\\
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   167
  \vspace*{0.2in}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   168
  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
   169
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   170
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   171
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   172
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   173
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   174
  In []: a = [1, 2, 5, 9]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   175
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   176
  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
   177
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   178
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   179
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   180
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   181
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   182
  In [1]: d = {
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   183
          'a': 1,
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   184
          'b': 2
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   185
          }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   186
  In [2]: print d['c']
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   187
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   188
  What is the output?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   189
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   190
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   191
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   192
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   193
\begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   194
In []: sc = {'A': 10, 'B': 20, 
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   195
             'C': 70}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   196
\end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   197
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
   198
pie-chart?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   199
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   200
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   201
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   202
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   203
\begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   204
In []: marks = [10, 20, 30, 50, 55, 
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   205
                75, 83] 
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   206
\end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   207
Given the above marks, how will you calculate the \alert{mean} and
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   208
\alert{standard deviation}?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   209
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   210
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   211
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   212
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   213
\begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   214
In []: marks = [10, 20, 30, 50, 55, 
371
9956a5bcd0f5 Changed quiz questions for AVIT.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 354
diff changeset
   215
                75, 83] 
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   216
\end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   217
How will you convert the list \texttt{marks} to an \alert{array}?
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   218
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 349
diff changeset
   219
261
9cce24d00957 1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   220
\end{document}