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