author | Nishanth Amuluru <nishanth@fossee.in> |
Tue, 14 Dec 2010 23:15:36 +0530 | |
branch | scipyin2010 |
changeset 456 | a27ccfc118fb |
parent 450 | 80028e4eee3d |
permissions | -rw-r--r-- |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
%Tutorial slides on Python. |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
% |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
4 |
% Author: FOSSEE |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
5 |
% Copyright (c) 2009, FOSSEE, IIT Bombay |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
\documentclass[14pt,compress]{beamer} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
%\documentclass[draft]{beamer} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
%\documentclass[compress,handout]{beamer} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
%\usepackage{pgfpages} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
% Modified from: generic-ornate-15min-45min.de.tex |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
\mode<presentation> |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
{ |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
\usetheme{Warsaw} |
239
8953675dc056
Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents:
228
diff
changeset
|
18 |
\useoutertheme{infolines} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
19 |
\setbeamercovered{transparent} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
20 |
} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
21 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
\usepackage[english]{babel} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
23 |
\usepackage[latin1]{inputenc} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
%\usepackage{times} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
\usepackage[T1]{fontenc} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
26 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
27 |
% Taken from Fernando's slides. |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
28 |
\usepackage{ae,aecompl} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
29 |
\usepackage{mathpazo,courier,euler} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
30 |
\usepackage[scaled=.95]{helvet} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
31 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
32 |
\definecolor{darkgreen}{rgb}{0,0.5,0} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
33 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
\usepackage{listings} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
\lstset{language=Python, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
basicstyle=\ttfamily\bfseries, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
37 |
commentstyle=\color{red}\itshape, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
stringstyle=\color{darkgreen}, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
showstringspaces=false, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
keywordstyle=\color{blue}\bfseries} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
43 |
% Macros |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
\setbeamercolor{emphbar}{bg=blue!20, fg=black} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
45 |
\newcommand{\emphbar}[1] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
46 |
{\begin{beamercolorbox}[rounded=true]{emphbar} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
47 |
{#1} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
\end{beamercolorbox} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
50 |
\newcounter{time} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
51 |
\setcounter{time}{0} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
52 |
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
53 |
|
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
54 |
\newcommand{\typ}[1]{\textbf{\texttt{#1}}} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
55 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
56 |
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
57 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
58 |
%%% This is from Fernando's setup. |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
59 |
% \usepackage{color} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
60 |
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
61 |
% % Use and configure listings package for nicely formatted code |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
62 |
% \usepackage{listings} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
63 |
% \lstset{ |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
64 |
% language=Python, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
65 |
% basicstyle=\small\ttfamily, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
66 |
% commentstyle=\ttfamily\color{blue}, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
67 |
% stringstyle=\ttfamily\color{orange}, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
68 |
% showstringspaces=false, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
69 |
% breaklines=true, |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
70 |
% postbreak = \space\dots |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
71 |
% } |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
72 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
73 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
74 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
75 |
% Title page |
251
457b67834245
Fixed typos and hanging words in Session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
76 |
\title[Basic Python]{Python language: Data structures and functions} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
77 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
78 |
\author[FOSSEE Team] {The FOSSEE Group} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
79 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
80 |
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
81 |
\date[] {SciPy.in 2010, Tutorials} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
82 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
83 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
84 |
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
85 |
%\logo{\pgfuseimage{iitmlogo}} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
86 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
87 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
88 |
%% Delete this, if you do not want the table of contents to pop up at |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
89 |
%% the beginning of each subsection: |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
90 |
\AtBeginSubsection[] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
91 |
{ |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
92 |
\begin{frame}<beamer> |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
93 |
\frametitle{Outline} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
94 |
\tableofcontents[currentsection,currentsubsection] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
95 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
96 |
} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
97 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
98 |
\AtBeginSection[] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
99 |
{ |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
100 |
\begin{frame}<beamer> |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
101 |
\frametitle{Outline} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
102 |
\tableofcontents[currentsection,currentsubsection] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
103 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
104 |
} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
105 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
106 |
% If you wish to uncover everything in a step-wise fashion, uncomment |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
107 |
% the following command: |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
108 |
%\beamerdefaultoverlayspecification{<+->} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
109 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
110 |
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
111 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
112 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
113 |
% DOCUMENT STARTS |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
114 |
\begin{document} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
115 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
116 |
\begin{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
117 |
\titlepage |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
118 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
119 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
120 |
\begin{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
121 |
\frametitle{Outline} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
122 |
\tableofcontents |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
123 |
% You might wish to add the option [pausesections] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
124 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
125 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
126 |
\section{Data structures} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
127 |
\subsection{Lists} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
128 |
\begin{frame}[fragile] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
129 |
\frametitle{Lists} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
130 |
\begin{block}{We already know that} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
131 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
132 |
num = [1, 2, 3, 4] |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
133 |
\end{lstlisting} |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
134 |
is a list |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
135 |
\end{block} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
136 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
137 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
138 |
\begin{frame}[fragile] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
139 |
\frametitle{Lists: methods} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
140 |
\begin{lstlisting} |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
141 |
In []: num = [9, 8, 2, 3, 7] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
142 |
|
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
143 |
In []: num + [4, 5, 6] |
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
144 |
Out[]: [9, 8, 2, 3, 7, 4, 5, 6] |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
145 |
|
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
146 |
In []: num.append([4, 5, 6]) |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
147 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
148 |
In []: num |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
149 |
Out[]: [9, 8, 2, 3, 7, [4, 5, 6]] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
150 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
151 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
152 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
153 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
154 |
\frametitle{Lists: methods} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
155 |
\begin{lstlisting} |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
156 |
In []: num = [9, 8, 2, 3, 7] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
157 |
|
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
158 |
In []: num.extend([4, 5, 6]) |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
159 |
In []: num |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
160 |
Out[]: [9, 8, 2, 3, 7, 4, 5, 6] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
161 |
|
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
162 |
In []: num.reverse() |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
163 |
In []: num |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
164 |
Out[]: [6, 5, 4, 7, 3, 2, 8, 9] |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
165 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
166 |
In []: num.remove(6) |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
167 |
In []: num |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
168 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
169 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
170 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
171 |
\begin{frame}[fragile] |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
172 |
\frametitle{List containership} |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
173 |
\emphbar{Recall \typ{num} is \typ{[9, 8, 2, 3, 7]}} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
174 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
175 |
In []: 4 in num |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
176 |
Out[]: False |
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
177 |
|
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
178 |
In []: b = 8 |
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
179 |
In []: b in num |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
180 |
Out[]: True |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
181 |
|
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
182 |
In []: b not in num |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
183 |
Out[]: False |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
184 |
\end{lstlisting} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
185 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
186 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
187 |
\subsection{Tuples} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
188 |
\begin{frame}[fragile] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
189 |
\frametitle{Tuples: Immutable lists} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
190 |
\begin{lstlisting} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
191 |
In []: t = (1, 2, 3, 4, 5, 6, 7, 8) |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
192 |
|
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
193 |
In []: t[0] + t[3] + t[-1] |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
194 |
Out[]: 13 |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
195 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
196 |
In []: t[4] = 7 |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
197 |
\end{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
198 |
\pause |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
199 |
\begin{block}{Note:} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
200 |
\begin{itemize} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
201 |
\item Tuples are immutable - cannot be changed |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
202 |
\end{itemize} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
203 |
\end{block} |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
204 |
|
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
205 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
206 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
207 |
\begin{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
208 |
{A classic problem} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
209 |
\begin{block} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
210 |
{Interchange values} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
211 |
How to interchange values of two variables? |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
212 |
\end{block} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
213 |
\pause |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
214 |
\begin{block}{Note:} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
215 |
This Python idiom works for all types of variables.\\ |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
216 |
They need not be of the same type! |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
217 |
\end{block} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
218 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
219 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
220 |
\subsection{Dictionaries} |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
221 |
|
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
222 |
\begin{frame}[fragile] |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
223 |
\frametitle{Dictionaries: Introduction} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
224 |
\begin{itemize} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
225 |
\item Lists index using integers\\ |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
226 |
Recall \typ{p = [2, 3, 5, 7]} and\\ |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
227 |
\typ{p[1]} is equal to \typ{3} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
228 |
\item Dictionaries index using strings |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
229 |
\end{itemize} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
230 |
\end{frame} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
231 |
|
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
232 |
\begin{frame}[fragile] |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
233 |
\frametitle{Dictionaries \ldots} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
234 |
\begin{lstlisting} |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
235 |
In []: d = {'png' : 'image file', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
236 |
'txt' : 'text file', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
237 |
'py' : 'python code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
238 |
'java': 'bad code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
239 |
'cpp': 'complex code'} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
240 |
|
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
241 |
In []: d['txt'] |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
242 |
Out[]: 'text file' |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
243 |
\end{lstlisting} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
244 |
\end{frame} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
245 |
|
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
246 |
\begin{frame}[fragile] |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
247 |
\frametitle{Dictionaries \ldots} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
248 |
\begin{lstlisting} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
249 |
In []: 'py' in d |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
250 |
Out[]: True |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
251 |
|
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
252 |
In []: 'jpg' in d |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
253 |
Out[]: False |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
254 |
\end{lstlisting} |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
255 |
\end{frame} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
256 |
|
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
257 |
\begin{frame}[fragile] |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
258 |
\frametitle{Dictionaries \ldots} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
259 |
\begin{small} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
260 |
\begin{lstlisting} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
261 |
In []: d.keys() |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
262 |
Out[]: ['cpp', 'py', 'txt', 'java', 'png'] |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
263 |
|
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
264 |
In []: d.values() |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
265 |
Out[]: ['complex code', 'python code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
266 |
'text file', 'bad code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
267 |
'image file'] |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
268 |
\end{lstlisting} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
269 |
\end{small} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
270 |
%% \inctime{10} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
271 |
\end{frame} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
272 |
|
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
273 |
\begin{frame}[fragile] |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
274 |
\frametitle{Inserting elements into dictionary} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
275 |
\emphbar{\alert{\typ{d[key] = value}}} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
276 |
\begin{lstlisting} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
277 |
In []: d['bin'] = 'binary file' |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
278 |
In []: d |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
279 |
Out[]: |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
280 |
{'bin': 'binary file', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
281 |
'cpp': 'complex code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
282 |
'java': 'bad code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
283 |
'png': 'image file', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
284 |
'py': 'python code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
285 |
'txt': 'text file'} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
286 |
\end{lstlisting} |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
287 |
\emphbar{\alert{Duplicate keys are overwritten!}} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
288 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
289 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
290 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
291 |
\frametitle{Dictionaries: containership} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
292 |
\begin{lstlisting} |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
293 |
In []: 'bin' in d |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
294 |
Out[]: True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
295 |
|
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
296 |
In []: 'hs' in d |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
297 |
Out[]: False |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
298 |
\end{lstlisting} |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
299 |
\begin{block}{Note} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
300 |
\begin{itemize} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
301 |
\item We can check for the containership of keys only |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
302 |
\item Not values |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
303 |
\end{itemize} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
304 |
\end{block} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
305 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
306 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
307 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
308 |
\frametitle{Dictionaries: methods} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
309 |
\begin{lstlisting} |
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
310 |
In []: d.keys() |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
311 |
Out[]: ['bin', 'java', 'py', 'cpp', 'txt', 'png'] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
312 |
|
450
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
313 |
In []: d.values() |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
314 |
Out[]: |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
315 |
['binary file', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
316 |
'bad code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
317 |
'python code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
318 |
'complex code', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
319 |
'text file', |
80028e4eee3d
Fixed day2/session2.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
424
diff
changeset
|
320 |
'image file'] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
321 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
322 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
323 |
|
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
324 |
\begin{frame} {Problem Set 2.1: Problem 2.1.1} |
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
325 |
You are given date strings of the form ``29 Jul, 2009'', or ``4 January 2008''. In other words a number, a string and another number, with a comma sometimes separating the items.\\Write a program that takes such a string as input and prints a tuple (yyyy, mm, dd) where all three elements are ints. |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
326 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
327 |
|
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
328 |
\subsection{Sets} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
329 |
\begin{frame}[fragile] |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
330 |
\frametitle{Sets} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
331 |
\begin{itemize} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
332 |
\item Simplest container, mutable |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
333 |
\item No ordering, no duplicates |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
334 |
\item usual suspects: union, intersection, subset \ldots |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
335 |
\item >, >=, <, <=, in, \ldots |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
336 |
\end{itemize} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
337 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
338 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
339 |
In []: f10 = set([1,2,3,5,8]) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
340 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
341 |
In []: p10 = set([2,3,5,7]) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
342 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
343 |
In []: f10 | p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
344 |
Out[]: set([1, 2, 3, 5, 7, 8]) |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
345 |
\end{lstlisting} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
346 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
347 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
348 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
349 |
\frametitle{Set \ldots} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
350 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
351 |
In []: f10 & p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
352 |
Out[]: set([2, 3, 5]) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
353 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
354 |
In []: f10 - p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
355 |
Out[]: set([1, 8]) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
356 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
357 |
In []: p10 - f10, f10 ^ p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
358 |
Out[]: (set([7]), set([1, 7, 8])) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
359 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
360 |
In []: set([2,3]) < p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
361 |
Out[]: True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
362 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
363 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
364 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
365 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
366 |
\frametitle{Set \ldots} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
367 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
368 |
In []: set([2,3]) <= p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
369 |
Out[]: True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
370 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
371 |
In []: 2 in p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
372 |
Out[]: True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
373 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
374 |
In []: 4 in p10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
375 |
Out[]: False |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
376 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
377 |
In []: len(f10) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
378 |
Out[]: 5 |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
379 |
\end{lstlisting} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
380 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
381 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
382 |
\begin{frame} |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
383 |
\frametitle{Problem set 2.2: Problem 2.2.1} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
384 |
Given a dictionary of the names of students and their marks, identify how many duplicate marks are there? and what are these? |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
385 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
386 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
387 |
\begin{frame} |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
388 |
\frametitle{Problem 2.2.2} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
389 |
Given a list of words, find all the anagrams in the list. |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
390 |
|
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
391 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
392 |
|
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
393 |
\begin{frame} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
251
diff
changeset
|
394 |
\frametitle{What did we learn?} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
395 |
\begin{itemize} |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
396 |
\item Advanced Data structures: |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
397 |
\begin{itemize} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
398 |
\item Lists |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
399 |
\item Tuples |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
400 |
\item Dictionaries |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
401 |
\item Sets |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
402 |
\end{itemize} |
228
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
403 |
\end{itemize} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
404 |
\end{frame} |
238f3010c981
Created and made first cut slides for session 2 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
405 |
|
330
46533051b9d3
commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents:
297
diff
changeset
|
406 |
\end{document} |
344
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
407 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
408 |
%% Questions for Quiz %% |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
409 |
%% ------------------ %% |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
410 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
411 |
\begin{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
412 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
413 |
How do you find the presence of an element \emph{x} in the list \emph{a}? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
414 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
415 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
416 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
417 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
418 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
419 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
420 |
In []: set([1, 2, 8, 2, 13, 8, 9]) |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
421 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
422 |
What is the output? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
423 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
424 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
425 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
426 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
427 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
428 |
In []: a = {'a': 1, 'b': 2} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
429 |
In []: a['a'] = 10 |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
430 |
In []: print a |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
431 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
432 |
What is the output? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
433 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
434 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
435 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
436 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
437 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
438 |
In []: for i in range(3, 10, 2): |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
439 |
...: print i |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
440 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
441 |
What is the output? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
442 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
443 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
444 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
445 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
446 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
447 |
In []: a = [1, 2, 3] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
448 |
In []: a.extend([5, 6]) |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
449 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
450 |
What is the value of a? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
451 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
452 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
453 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
454 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
455 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
456 |
In []: a = (1, 2, 3) |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
457 |
In []: a[1] = 10 |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
458 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
459 |
What is the result? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
460 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
461 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
462 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
463 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
464 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
465 |
def func(x, y=10): |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
466 |
print x+1, y+10 |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
467 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
468 |
func(1) |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
469 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
470 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
471 |
What is the output? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
472 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
473 |