sets/quickref.tex
author anand
Thu, 11 Nov 2010 00:03:57 +0530
changeset 472 fcdec2d28c9a
parent 333 91b427241f8f
child 523 54bdda4aefa5
permissions -rw-r--r--
Checklist OK for `The other kinds of plots`
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
333
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     1
Creating a set:\\
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     2
{\ex \lstinline|   p10 = set([2, 3, 5, 7]) |t}
233
ab748264f726 Made sets.rst into the new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     3
333
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     4
Creating set from a tuple or list:\\
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     5
{\ex \lstinline|   s = set(var_name)|}
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     6
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     7
Operations on sets. Ex: UNION:\\
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     8
{\ex \lstinline|   s1 \| s2 |}
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
     9
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    10
Other operations available:\\
233
ab748264f726 Made sets.rst into the new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    11
333
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    12
\begin{lstlising}
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    13
\item "\&" -- Intersection
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    14
\item "-" -- Difference
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    15
\item "\^" -- Symmetric Difference
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    16
\item "<" -- Subset
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    17
\end{lstlisting}
233
ab748264f726 Made sets.rst into the new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    18
333
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    19
Checking for containership:\\
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    20
{\ex \lstinline|    x in p10|}
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    21
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    22
Finding the no.of elements:\\
91b427241f8f Finished sets
Nishanth <nishanth@fossee.in>
parents: 233
diff changeset
    23
{\ex \lstinline|    len(p10)|}