258 \begin{lstlisting} |
258 \begin{lstlisting} |
259 In []: lst[1:3] # A slice. |
259 In []: lst[1:3] # A slice. |
260 Out[]: [2, 3] |
260 Out[]: [2, 3] |
261 |
261 |
262 In []: lst[1:-1] |
262 In []: lst[1:-1] |
263 Out[]: [2, 3] |
263 Out[]: [2, 3, 4] |
264 \end{lstlisting} |
264 \end{lstlisting} |
265 \alert{\typ{list[initial:final]}} |
265 \alert{\typ{list[initial:final]}} |
266 \end{frame} |
266 \end{frame} |
267 |
267 |
268 \begin{frame}[fragile] |
268 \begin{frame}[fragile] |
269 \frametitle{List operations} |
269 \frametitle{List operations} |
270 \begin{lstlisting} |
270 \begin{lstlisting} |
271 In []: anthrlst = [ 6, 7, 8, 9] |
271 In []: a = [ 6, 7, 8, 9] |
272 In []: lnglst = lst + anthrlst |
272 In []: b = lst + a |
273 |
273 |
274 In []: lnglst |
274 In []: b |
275 Out[]: [1, 2, 3, 4, 5, 6, 7, 8, 9] |
275 Out[]: [1, 2, 3, 4, 5, 6, 7, 8, 9] |
276 |
276 |
277 In []: lst.append(6) |
277 In []: lst.append(6) |
278 In []: lst |
278 In []: lst |
279 Out[]: [ 1, 2, 3, 4, 5, 6] |
279 Out[]: [ 1, 2, 3, 4, 5, 6] |