day2/session1.tex
changeset 140 fe6a38572a65
parent 135 a5da7607ab14
child 204 87f914f38ba1
equal deleted inserted replaced
139:039a07b0ff53 140:fe6a38572a65
   341 In []: lst
   341 In []: lst
   342 Out[]: [8, 7, 6, 5, 4, 3, 2, 1]
   342 Out[]: [8, 7, 6, 5, 4, 3, 2, 1]
   343 
   343 
   344 In []: lst.extend([0, -1, -2])
   344 In []: lst.extend([0, -1, -2])
   345 In []: lst
   345 In []: lst
   346 Out[]: [8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2]
   346 Out[]: [8, 7, 6, 5, 4, 3, 2, 1, 0, -1]
   347 
   347 
   348 In []: lst.remove(0)
   348 In []: lst.remove(0)
   349 In []: lst
   349 In []: lst
   350 Out[]: [8, 7, 6, 5, 4, 3, 2, 1, -1, -2]
   350 Out[]: [8, 7, 6, 5, 4, 3, 2, 1, -1]
   351 \end{lstlisting}
   351 \end{lstlisting}
   352 \end{frame}
   352 \end{frame}
   353 
   353 
   354 \begin{frame}[fragile]
   354 \begin{frame}[fragile]
   355 \frametitle{List containership}
   355 \frametitle{List containership}
   390 \section{Dictionaries}
   390 \section{Dictionaries}
   391 \begin{frame}[fragile]
   391 \begin{frame}[fragile]
   392 \frametitle{Dictionaries}
   392 \frametitle{Dictionaries}
   393   \alert {lists and tuples: integer indexes :: dictionaries: string indexes}
   393   \alert {lists and tuples: integer indexes :: dictionaries: string indexes}
   394 \begin{lstlisting}
   394 \begin{lstlisting}
   395 In []: player = {'Mat': 134, 'Inn': 233, 'Runs': 10823, 'Avg': 52.53}
   395 In []: player = {'Mat': 134,'Inn': 233, 
       
   396            'Runs': 10823, 'Avg': 52.53}
   396 
   397 
   397 In []: player['Avg']
   398 In []: player['Avg']
   398 Out[]: 52.530000000000001
   399 Out[]: 52.530000000000001
   399 
       
   400 In []: player.keys()
   400 In []: player.keys()
   401 Out[]: ['Runs', 'Inn', 'Avg', 'Mat']
   401 Out[]: ['Runs', 'Inn', 'Avg', 'Mat']
   402 
       
   403 In []: player.values()
   402 In []: player.values()
   404 Out[]: [10823, 233, 52.530000000000001, 134]
   403 Out[]: [10823, 233, 
       
   404        52.530000000000001, 134]
   405 \end{lstlisting}
   405 \end{lstlisting}
   406 \end{frame}
   406 \end{frame}
   407 
   407 
   408 \begin{frame}{Dictionaries}
   408 \begin{frame}{Dictionaries}
   409 \begin{itemize}
   409 \begin{itemize}