author | bhanu |
Mon, 15 Nov 2010 15:00:34 +0530 | |
changeset 503 | a858141ad884 |
parent 333 | 91b427241f8f |
child 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 |
|
333 | 12 |
\begin{lstlising} |
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)|} |