|
1 % Created 2010-10-10 Sun 23:53 |
|
2 \documentclass[presentation]{beamer} |
|
3 \usepackage[latin1]{inputenc} |
|
4 \usepackage[T1]{fontenc} |
|
5 \usepackage{fixltx2e} |
|
6 \usepackage{graphicx} |
|
7 \usepackage{longtable} |
|
8 \usepackage{float} |
|
9 \usepackage{wrapfig} |
|
10 \usepackage{soul} |
|
11 \usepackage{textcomp} |
|
12 \usepackage{marvosym} |
|
13 \usepackage{wasysym} |
|
14 \usepackage{latexsym} |
|
15 \usepackage{amssymb} |
|
16 \usepackage{hyperref} |
|
17 \tolerance=1000 |
|
18 \usepackage[english]{babel} \usepackage{ae,aecompl} |
|
19 \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} |
|
20 \usepackage{listings} |
|
21 \lstset{language=Python, basicstyle=\ttfamily\bfseries, |
|
22 commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, |
|
23 showstringspaces=false, keywordstyle=\color{blue}\bfseries} |
|
24 \providecommand{\alert}[1]{\textbf{#1}} |
|
25 |
|
26 \title{Sets} |
|
27 \author{FOSSEE} |
|
28 \date{} |
|
29 |
|
30 \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} |
|
31 \begin{document} |
|
32 |
|
33 \maketitle |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 \begin{frame} |
|
44 \frametitle{Outline} |
|
45 \label{sec-1} |
|
46 |
|
47 \begin{itemize} |
|
48 \item Defining Sets |
|
49 \item Operations on sets |
|
50 \end{itemize} |
|
51 \end{frame} |
|
52 \begin{frame} |
|
53 \frametitle{Question 1} |
|
54 \label{sec-2} |
|
55 |
|
56 Given a list of marks, \texttt{marks = [20, 23, 22, 23, 20, 21, 23]} list |
|
57 all the duplicates |
|
58 \end{frame} |
|
59 \begin{frame}[fragile] |
|
60 \frametitle{Solution 1} |
|
61 \label{sec-3} |
|
62 |
|
63 \lstset{language=Python} |
|
64 \begin{lstlisting} |
|
65 marks = [20, 23, 22, 23, 20, 21, 23] |
|
66 marks_set = set(marks) |
|
67 for mark in marks_set: |
|
68 marks.remove(mark) |
|
69 |
|
70 # we are now left with only duplicates in the list marks |
|
71 duplicates = set(marks) |
|
72 \end{lstlisting} |
|
73 \end{frame} |
|
74 \begin{frame} |
|
75 \frametitle{Summary} |
|
76 \label{sec-4} |
|
77 |
|
78 You should now be able to -- |
|
79 \begin{itemize} |
|
80 \item make sets from lists |
|
81 \item input sets directly |
|
82 \item perform operations like union, intersection, symmetric difference |
|
83 \item check if a subset of another |
|
84 \item check containership, length and other properties similar to lists |
|
85 \end{itemize} |
|
86 \end{frame} |
|
87 \begin{frame} |
|
88 \frametitle{Thank you!} |
|
89 \label{sec-5} |
|
90 |
|
91 \begin{block}{} |
|
92 \begin{center} |
|
93 This spoken tutorial has been produced by the |
|
94 \textcolor{blue}{FOSSEE} team, which is funded by the |
|
95 \end{center} |
|
96 \begin{center} |
|
97 \textcolor{blue}{National Mission on Education through \\ |
|
98 Information \& Communication Technology \\ |
|
99 MHRD, Govt. of India}. |
|
100 \end{center} |
|
101 \end{block} |
|
102 \end{frame} |
|
103 |
|
104 \end{document} |