dictionaries/slides.tex
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 20 Oct 2010 16:19:55 +0530
changeset 341 9f7eb1ed0e08
parent 300 a130a1f494c3
permissions -rw-r--r--
Merged heads.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
300
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     1
% Created 2010-10-11 Mon 23:02
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     2
\documentclass[presentation]{beamer}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     3
\usepackage[latin1]{inputenc}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     4
\usepackage[T1]{fontenc}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     5
\usepackage{fixltx2e}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     6
\usepackage{graphicx}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     7
\usepackage{longtable}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     8
\usepackage{float}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     9
\usepackage{wrapfig}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    10
\usepackage{soul}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    11
\usepackage{t1enc}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    12
\usepackage{textcomp}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    13
\usepackage{marvosym}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    14
\usepackage{wasysym}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    15
\usepackage{latexsym}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    16
\usepackage{amssymb}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    17
\usepackage{hyperref}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    18
\tolerance=1000
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    19
\usepackage[english]{babel} \usepackage{ae,aecompl}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    20
\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    21
\usepackage{listings}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    22
\lstset{language=Python, basicstyle=\ttfamily\bfseries,
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    23
commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    24
showstringspaces=false, keywordstyle=\color{blue}\bfseries}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    25
\providecommand{\alert}[1]{\textbf{#1}}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    26
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    27
\title{Dictionaries}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    28
\author{FOSSEE}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    29
\date{}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    30
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    31
\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    32
\begin{document}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    33
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    34
\maketitle
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    35
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    36
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    37
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    38
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    39
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    40
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    41
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    42
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    43
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    44
\begin{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    45
\frametitle{Outline}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    46
\label{sec-1}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    47
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    48
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    49
\item Creating dictionaries
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    50
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    51
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    52
\item empty dictionaries
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    53
\item with data
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    54
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    55
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    56
\item Keys and values
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    57
\item Checking for elements
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    58
\item Iterating over elements
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    59
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    60
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    61
\begin{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    62
\frametitle{Overview of Dictionaries}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    63
\label{sec-2}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    64
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    65
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    66
\item A dictionary contains meaning of words
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    67
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    68
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    69
\item \emph{Word} is the \emph{key} here.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    70
\item \emph{Meaning} is the \emph{value} here.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    71
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    72
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    73
\item A Key-Value pair data structure
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    74
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    75
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    76
\item Provide key-value mappings
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    77
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    78
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    79
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    80
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    81
\begin{frame}[fragile]
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    82
\frametitle{Creating dictionary}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    83
\label{sec-3}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    84
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    85
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    86
\item Empty dictionary
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    87
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    88
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    89
\item \texttt{mt\_dict = \{\}}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    90
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    91
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    92
\item \texttt{[]} - lists
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    93
\item \texttt{\{\}} - dictionaries
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    94
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    95
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    96
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    97
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    98
\item With data
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    99
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   100
extensions = {'jpg' : 'JPEG Image', 
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   101
              'py' : 'Python script',
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   102
              'html' : 'Html document', 
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   103
              'pdf' : 'Portable Document Format'}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   104
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   105
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   106
   \textbf{Note} - ordering in dictionaries cannot be relied on
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   107
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   108
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   109
\begin{frame}[fragile]
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   110
\frametitle{Accessing Elements}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   111
\label{sec-4}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   112
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   113
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   114
\item syntax
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   115
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   116
     extensions[key]
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   117
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   118
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   119
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   120
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   121
  
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   122
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   123
   In []: print extensions['jpg']
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   124
   Out []: JPEG Image
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   125
   In []: print extensions['zip']
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   126
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   127
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   128
\begin{frame}[fragile]
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   129
\frametitle{Adding and Deleting values}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   130
\label{sec-5}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   131
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   132
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   133
\item Adding a new value
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   134
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   135
     In []: extension['cpp'] = 'C++ code'
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   136
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   137
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   138
    adds a new key \emph{cpp} with \emph{C++ code} as value
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   139
\item Deleting values
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   140
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   141
     In []: del extensions['pdf']
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   142
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   143
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   144
    deletes the key-value pair identified by \emph{pdf}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   145
\item Changing value associated with a key
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   146
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   147
     In []: extension['cpp'] = 'C++ source code'
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   148
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   149
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   150
    changes the value of the existing key
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   151
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   152
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   153
\begin{frame}[fragile]
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   154
\frametitle{Checking for container-ship of keys}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   155
\label{sec-6}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   156
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   157
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   158
   In []: 'py' in extensions
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   159
   Out []: True
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   160
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   161
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   162
  Returns \textbf{True} if the \emph{key} is found.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   163
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   164
   In []: 'odt' in extensions
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   165
   Out []: False
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   166
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   167
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   168
  Returns \textbf{False} if the \emph{key} is not found.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   169
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   170
\begin{frame}[fragile]
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   171
\frametitle{Retrieve keys and values}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   172
\label{sec-7}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   173
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   174
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   175
\item \texttt{.keys()} method
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   176
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   177
     In []: extensions.keys()
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   178
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   179
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   180
    Returns a list of keys in the dictionary.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   181
\item \texttt{.values()} method
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   182
\begin{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   183
     In []: extensions.values()
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   184
\end{verbatim}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   185
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   186
    Returns the list of values in the dictionary.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   187
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   188
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   189
\begin{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   190
\frametitle{Exercise 1}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   191
\label{sec-8}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   192
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   193
  Print the keys and values in the dictionary one by one.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   194
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   195
\begin{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   196
\frametitle{Summary}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   197
\label{sec-9}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   198
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   199
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   200
\item Creating dictionaries
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   201
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   202
\begin{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   203
\item empty dictionaries
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   204
\item with data
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   205
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   206
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   207
\item \texttt{.keys()} method
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   208
\item \texttt{.values()} method
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   209
\item Iterating over dictionaries
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   210
\end{itemize}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   211
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   212
\begin{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   213
\frametitle{Thank you!}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   214
\label{sec-10}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   215
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   216
  \begin{block}{}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   217
  \begin{center}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   218
  This spoken tutorial has been produced by the
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   219
  \textcolor{blue}{FOSSEE} team, which is funded by the 
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   220
  \end{center}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   221
  \begin{center}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   222
    \textcolor{blue}{National Mission on Education through \\
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   223
      Information \& Communication Technology \\ 
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   224
      MHRD, Govt. of India}.
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   225
  \end{center}  
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   226
  \end{block}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   227
\end{frame}
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   228
a130a1f494c3 added slides for dictionaries.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   229
\end{document}