getting-started-with-lists/slides.org
author Amit Sethi
Wed, 10 Nov 2010 12:23:40 +0530
changeset 441 430035b678f7
parent 406 a534e9e79599
permissions -rw-r--r--
Exercises for getting started with lists and some changes based on review

#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation]
#+BEAMER_FRAME_LEVEL: 1

#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC

#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation]

#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}

#+LaTeX_HEADER: \usepackage{listings}

#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
#+LaTeX_HEADER:  commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
#+LaTeX_HEADER:  showstringspaces=false, keywordstyle=\color{blue}\bfseries}

#+TITLE: Getting started with Lists
#+AUTHOR: FOSSEE
#+DATE: 2010-09-14 Tue
#+EMAIL:     info@fossee.in

#+DESCRIPTION: 
#+KEYWORDS: 
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc


* Outline 
 - How to create lists
 - Structure of lists  
 - Access list elements
 - Append elements to lists
 - Deleting elements from lists


* Question 1 
  - What happens when you do nonempty[-1].

* Solution 1
  - It gives the last element , 1.234

* Questions
  - What is the syntax to get the element 'and' 
in the list,listinlist ?


  - How would you get 'and' using negative indices?

* Solutions
#+begin_src python
  
  listinlist[1]
  listinlist[-5]

#+end_src python
* Questions

  - Remove the third element from the list, listinlist.   

  - Remove 'and' from the list, listinlist.

* Solutions
#+begin_src python
  
  del(listinlist[2])
  listinlist.remove('and')

#+end_src python
* Summary
#+begin_src python
  
  l=[1,2,3,4]
  l[-1]
  l.append(5)
  del(l[2])
  l.remove(2)
  len(l)

#+end_src python
* Thank you!
#+begin_latex
  \begin{block}{}
  \begin{center}
  This spoken tutorial has been produced by the
  \textcolor{blue}{FOSSEE} team, which is funded by the 
  \end{center}
  \begin{center}
    \textcolor{blue}{National Mission on Education through \\
      Information \& Communication Technology \\ 
      MHRD, Govt. of India}.
  \end{center}  
  \end{block}
#+end_latex