author | Madhusudan.C.S <madhusudancs@gmail.com> |
Wed, 11 Nov 2009 12:30:18 +0530 | |
changeset 302 | 8ea4739a7f1f |
parent 261 | 9cce24d00957 |
permissions | -rw-r--r-- |
261
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
2 |
% Tutorial slides on Python. |
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 |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
38 |
\title[Basic Python]{Python: Quiz} |
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} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
43 |
\date[] {11, October 2009\\Day 2} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
44 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
45 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
46 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
47 |
\begin{document} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
48 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
49 |
\begin{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
50 |
\titlepage |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
51 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
52 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
53 |
\begin{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
54 |
\frametitle{Write your details...} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
55 |
On the top right hand corner please write down the following: |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
56 |
\begin{itemize} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
57 |
\item Name: |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
58 |
\item Affliation: |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
59 |
\item Occupation: |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
60 |
\end{itemize} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
61 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
62 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
63 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
64 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
65 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
66 |
>>> x = array([[1,2,3,4],[3,4,2,5]]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
67 |
>>> x.shape |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
68 |
(2, 4) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
69 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
70 |
Change the shape of \lstinline+x+ to (4,2) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
71 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
72 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
73 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
74 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
75 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
76 |
>>> x = array([[1,2,3,4]]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
77 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
78 |
How to change the third element of \lstinline+x+ to 0? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
79 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
80 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
81 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
82 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
83 |
What would be the result? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
84 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
85 |
>>> y = arange(3) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
86 |
>>> x = linspace(0,3,3) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
87 |
>>> x-y |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
88 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
89 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
90 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
91 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
92 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
93 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
94 |
>>> x = array([0, 1, 2, 3]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
95 |
>>> x.shape = 2,2 |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
96 |
>>> x |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
97 |
array([[0, 1], |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
98 |
[2, 3]]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
99 |
>>> x[::2,::2] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
100 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
101 |
What is the output? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
102 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
103 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
104 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
105 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
106 |
What would be the result? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
107 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
108 |
>>> x |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
109 |
array([[0, 1, 2], |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
110 |
[3, 4, 5], |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
111 |
[6, 7, 8]]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
112 |
>>> x[::-1,:] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
113 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
114 |
Hint: |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
115 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
116 |
>>> x = arange(9) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
117 |
>>> x[::-1] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
118 |
array([8, 7, 6, 5, 4, 3, 2, 1, 0]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
119 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
120 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
121 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
122 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
123 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
124 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
125 |
>>> x |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
126 |
array([[ 0, 1, 2, 3], |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
127 |
[ 4, 5, 6, 7], |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
128 |
[ 8, 9, 10, 11], |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
129 |
[12, 13, 14, 15]]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
130 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
131 |
How will you get the following \lstinline+x+? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
132 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
133 |
array([[ 5, 7], |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
134 |
[ 9, 11]]) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
135 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
136 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
137 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
138 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
139 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
140 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
141 |
>>> x = array(([1,2,3,4],[2,3,4,5])) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
142 |
>>> x[-2][-3] = 4 |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
143 |
>>> x |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
144 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
145 |
What will be printed? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
146 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
147 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
148 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
149 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
150 |
What would be the output? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
151 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
152 |
>>> y = arange(4) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
153 |
>>> x = array(([1,2,3,2],[1,3,6,0])) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
154 |
>>> x + y |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
155 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
156 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
157 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
158 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
159 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
160 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
161 |
>>> line = plot(x, sin(x)) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
162 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
163 |
Use the \lstinline+set_linewidth+ method to set width of \lstinline+line+ to 2. |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
164 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
165 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
166 |
\begin{frame}[fragile] |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
167 |
\frametitle{\incqno } |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
168 |
What would be the output? |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
169 |
\begin{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
170 |
>>> x = arange(9) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
171 |
>>> y = arange(9.) |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
172 |
>>> x == y |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
173 |
\end{lstlisting} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
174 |
\end{frame} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
175 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
176 |
|
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
177 |
\end{document} |
9cce24d00957
1 quiz, seesion5 plots, added links to reference.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
178 |