sets/slides.org
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 10 Nov 2010 10:47:21 +0530
changeset 436 e62bc810999c
parent 427 c193744340ba
permissions -rw-r--r--
Cleaned up getting started with strings LO.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
281
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
#+LaTeX_CLASS: beamer
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
#+LaTeX_CLASS_OPTIONS: [presentation]
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
#+BEAMER_FRAME_LEVEL: 1
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
#+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
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
#+LaTeX_CLASS: beamer
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
#+LaTeX_CLASS_OPTIONS: [presentation]
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
#+LaTeX_HEADER: \usepackage{listings}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
#+LaTeX_HEADER:  commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
#+LaTeX_HEADER:  showstringspaces=false, keywordstyle=\color{blue}\bfseries}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
#+TITLE:    Sets
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
#+AUTHOR:    FOSSEE
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
#+EMAIL:     
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
#+DATE:    
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
#+DESCRIPTION: 
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
#+KEYWORDS: 
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
#+LANGUAGE:  en
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
#+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
#+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
* Outline
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
  - Defining Sets
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
  - Operations on sets
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
* Question 1
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
  Given a list of marks, ~marks = [20, 23, 22, 23, 20, 21, 23]~ list
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
  all the duplicates
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
* Solution 1
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
  #+begin_src python
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
    marks = [20, 23, 22, 23, 20, 21, 23] 
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
    marks_set = set(marks)
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
    for mark in marks_set:
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
        marks.remove(mark)
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
    
427
c193744340ba Cleaned up sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
    46
    # we are now left with only duplicates
c193744340ba Cleaned up sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
    47
    # in the list marks
281
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
    duplicates = set(marks)
427
c193744340ba Cleaned up sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
    49
        
281
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
  #+end_src
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
* Summary
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
  You should now be able to --
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
  + make sets from lists
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
  + input sets directly
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
  + perform operations like union, intersection, symmetric difference
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
  + check if a subset of another
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
  + check containership, length and other properties similar to lists
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
* Thank you!
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
#+begin_latex
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
  \begin{block}{}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
  \begin{center}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
  This spoken tutorial has been produced by the
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
  \textcolor{blue}{FOSSEE} team, which is funded by the 
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
  \end{center}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
  \begin{center}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
    \textcolor{blue}{National Mission on Education through \\
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
      Information \& Communication Technology \\ 
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
      MHRD, Govt. of India}.
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
  \end{center}  
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
  \end{block}
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
#+end_latex
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
d91133654fc8 Slides for sets LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73