author | Puneeth Chaganti <punchagan@fossee.in> |
Tue, 09 Nov 2010 16:51:00 +0530 | |
changeset 425 | c943cdbee397 |
parent 282 | 8c35d7977f04 |
child 505 | 394c3642cf9c |
permissions | -rw-r--r-- |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
1 |
.. Objectives |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
2 |
.. ---------- |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
3 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
4 |
.. At the end of the tutorial, you will |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
5 |
.. #. have a clear understand of what tuples are |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
6 |
.. #. be able to compare them with lists |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
7 |
.. #. know why they are needed and where to use them |
282
8c35d7977f04
Slides for tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
232
diff
changeset
|
8 |
|
8c35d7977f04
Slides for tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
232
diff
changeset
|
9 |
|
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
10 |
.. Prerequisites |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
11 |
.. ------------- |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
12 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
13 |
.. 1. Getting started with lists |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
14 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
15 |
.. Author : Nishanth Amuluru |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
16 |
Internal Reviewer : |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
17 |
External Reviewer : |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
18 |
Checklist OK? : <put date stamp here, if OK> [2010-10-05] |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
19 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
20 |
Script |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
21 |
------ |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
22 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
23 |
Hello friends and welcome to the tutorial on getting started with |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
24 |
tuples. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
25 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
26 |
{{{ Show the slide containing title }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
27 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
28 |
{{{ Show the slide containing the outline slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
29 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
30 |
In this tutorial, we shall learn |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
31 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
32 |
* what are tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
33 |
* their similarities and dissimilarities with lists |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
34 |
* why are they needed |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
35 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
36 |
Let's get started by defining a tuple. A tuple is defined by enclosing |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
37 |
parentheses around a sequence of items seperated by commas. It is |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
38 |
similar to defining a list except that parentheses are used instead of |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
39 |
square brackets. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
40 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
41 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
42 |
t = (1, 2.5, "hello", -4, "world", 1.24, 5) |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
43 |
t |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
44 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
45 |
defines a tuple. The items in the tuple are indexed using numbers and can be |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
46 |
accessed by using their position. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
47 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
48 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
49 |
t[3] |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
50 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
51 |
prints -4 which is the fourth item of the tuple. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
52 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
53 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
54 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
55 |
t[1:5:2] |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
56 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
57 |
prints the corresponding slice |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
58 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
59 |
This is the behaviour similar as to lists. But the difference can be seen when |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
60 |
we try to change an element in the tuple. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
61 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
62 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
63 |
t[2] = "Hello" |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
64 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
65 |
We can see that, it raises an error saying tuple does not support item |
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
66 |
assignment. Tuples are immutable, and cannot be changed after |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
67 |
creation. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
68 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
69 |
Then, what's the use of tuples? |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
70 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
71 |
We shall understand that soon. But let us look at a simple problem of swapping |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
72 |
values. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
73 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
74 |
{{{ Pause here and try out the following exercises }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
75 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
76 |
%% 1 %% a = 5 and b = 7. swap the values of a and b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
77 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
78 |
{{{ continue from paused state }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
79 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
80 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
81 |
a = 5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
82 |
b = 7 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
83 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
84 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
85 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
86 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
87 |
We define the two values |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
88 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
89 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
90 |
temp = a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
91 |
a = b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
92 |
b = temp |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
93 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
94 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
95 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
96 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
97 |
This is the traditional approach |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
98 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
99 |
Now let us do it the python way |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
100 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
101 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
102 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
103 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
104 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
105 |
a, b = b, a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
106 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
107 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
108 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
109 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
110 |
We see that the values are swapped. This idiom works for different |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
111 |
data-types also. |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
112 |
|
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
113 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
114 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
115 |
a = 2.5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
116 |
b = "hello" |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
117 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
118 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
119 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
120 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
121 |
Moreover this type of behaviour is something that feels natural and |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
122 |
you'd expect to happen. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
123 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
124 |
This is possible because of the immutability of tuples. This process is called |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
125 |
tuple packing and unpacking. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
126 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
127 |
Let us first see what is tuple packing. Type |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
128 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
129 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
130 |
5, |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
131 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
132 |
What we see is a tuple with one element. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
133 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
134 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
135 |
5, "hello", 2.5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
136 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
137 |
Now it is a tuple with three elements. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
138 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
139 |
So when we are actually typing two or more elements seperated by commas, those |
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
140 |
elements are packed into a tuple. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
141 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
142 |
When you type |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
143 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
144 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
145 |
a, b = b, a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
146 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
147 |
First the values of b and a are packed into a tuple on the right side and then |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
148 |
unpacked into the variables a and b. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
149 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
150 |
Immutability of tuples ensures that the values are not changed during the |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
151 |
packing and unpacking. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
152 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
153 |
{{{ Show summary slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
154 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
155 |
This brings us to the end of the tutorial. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
156 |
we have learnt |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
157 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
158 |
* How to define tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
159 |
* The similarities of tuples with lists, like indexing and iterability |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
160 |
* The immutability of tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
161 |
* The value swapping idiom in Python |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
162 |
* packing and unpacking of tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
163 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
164 |
{{{ Show the "sponsored by FOSSEE" slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
165 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
166 |
This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
167 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
168 |
Hope you have enjoyed and found it useful. |
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
169 |
Thank you |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
170 |