author | Anoop Jacob Thomas<anoop@fossee.in> |
Sat, 18 Dec 2010 12:54:49 +0530 | |
changeset 524 | b602b4dcc87d |
parent 523 | 54bdda4aefa5 |
permissions | -rw-r--r-- |
333 | 1 |
Creating a set:\\ |
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 | 4 |
Creating set from a tuple or list:\\ |
5 |
{\ex \lstinline| s = set(var_name)|} |
|
6 |
||
7 |
Operations on sets. Ex: UNION:\\ |
|
8 |
{\ex \lstinline| s1 \| s2 |} |
|
9 |
||
10 |
Other operations available:\\ |
|
233
ab748264f726
Made sets.rst into the new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
11 |
|
523
54bdda4aefa5
Renamed some LOs and other minor corrections.
Puneeth Chaganti <punchagan@fossee.in>
parents:
333
diff
changeset
|
12 |
\begin{lstlisting} |
333 | 13 |
\item "\&" -- Intersection |
14 |
\item "-" -- Difference |
|
15 |
\item "\^" -- Symmetric Difference |
|
16 |
\item "<" -- Subset |
|
17 |
\end{lstlisting} |
|
233
ab748264f726
Made sets.rst into the new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
18 |
|
333 | 19 |
Checking for containership:\\ |
20 |
{\ex \lstinline| x in p10|} |
|
21 |
||
22 |
Finding the no.of elements:\\ |
|
23 |
{\ex \lstinline| len(p10)|} |