author | bhanu |
Mon, 15 Nov 2010 15:07:22 +0530 | |
changeset 505 | 394c3642cf9c |
parent 425 | c943cdbee397 |
child 506 | ea74e6056453 |
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 |
505
394c3642cf9c
Language check done for `getting started with tuples`
bhanu
parents:
425
diff
changeset
|
16 |
Internal Reviewer : Punch |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
17 |
External Reviewer : |
505
394c3642cf9c
Language check done for `getting started with tuples`
bhanu
parents:
425
diff
changeset
|
18 |
Language Reviewer : Bhanukiran |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
19 |
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
|
20 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
21 |
Script |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
22 |
------ |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
23 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
24 |
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
|
25 |
tuples. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
26 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
27 |
{{{ Show the slide containing title }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
28 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
29 |
{{{ Show the slide containing the outline slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
30 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
31 |
In this tutorial, we shall learn |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
32 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
33 |
* what are tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
34 |
* their similarities and dissimilarities with lists |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
35 |
* why are they needed |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
36 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
square brackets. |
232
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
43 |
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
|
44 |
t |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
45 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
46 |
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
|
47 |
accessed by using their position. |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
50 |
t[3] |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
51 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
52 |
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
|
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
56 |
t[1:5:2] |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
57 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
58 |
prints the corresponding slice |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
59 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
60 |
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
|
61 |
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
|
62 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
63 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
64 |
t[2] = "Hello" |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
65 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
66 |
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
|
67 |
assignment. Tuples are immutable, and cannot be changed after |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
68 |
creation. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
69 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
70 |
Then, what's the use of tuples? |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
71 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
72 |
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
|
73 |
values. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
74 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
75 |
{{{ Pause here and try out the following exercises }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
76 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
77 |
%% 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
|
78 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
79 |
{{{ continue from paused state }}} |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
82 |
a = 5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
83 |
b = 7 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
84 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
85 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
86 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
87 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
88 |
We define the two values |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
91 |
temp = a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
92 |
a = b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
93 |
b = temp |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
94 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
95 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
96 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
97 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
98 |
This is the traditional approach |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
99 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
100 |
Now let us do it the python way |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
103 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
104 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
105 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
106 |
a, b = b, a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
107 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
108 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
109 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
110 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
111 |
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
|
112 |
data-types also. |
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
113 |
|
232
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
116 |
a = 2.5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
117 |
b = "hello" |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
118 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
119 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
120 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
121 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
122 |
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
|
123 |
you'd expect to happen. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
124 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
125 |
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
|
126 |
tuple packing and unpacking. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
127 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
128 |
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
|
129 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
130 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
131 |
5, |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
132 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
133 |
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
|
134 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
135 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
136 |
5, "hello", 2.5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
137 |
|
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
138 |
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
|
139 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
140 |
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
|
141 |
elements are packed into a tuple. |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
142 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
143 |
When you type |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
146 |
a, b = b, a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
147 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
148 |
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
|
149 |
unpacked into the variables a and b. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
150 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
151 |
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
|
152 |
packing and unpacking. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
153 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
154 |
{{{ Show summary slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
155 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
156 |
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
|
157 |
we have learnt |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
158 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
159 |
* How to define tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
160 |
* 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
|
161 |
* The immutability of tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
162 |
* The value swapping idiom in Python |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
163 |
* packing and unpacking of tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
164 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
165 |
{{{ Show the "sponsored by FOSSEE" slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
166 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
167 |
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
|
168 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
169 |
Hope you have enjoyed and found it useful. |
425
c943cdbee397
Cleaned up tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
170 |
Thank you |
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
171 |