author | Puneeth Chaganti <punchagan@fossee.in> |
Tue, 19 Oct 2010 14:26:02 +0530 | |
changeset 337 | c65d0d9fc0c8 |
parent 282 | 8c35d7977f04 |
child 425 | c943cdbee397 |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
4 |
.. A - Students and teachers from Science and engineering backgrounds |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
5 |
B - Will learn what are tuples and why they are needed |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
6 |
Will learn the various methods of accessing elements in tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
7 |
C - |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
8 |
D - |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
9 |
|
282
8c35d7977f04
Slides for tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
232
diff
changeset
|
10 |
.. #. what are tuples |
8c35d7977f04
Slides for tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
232
diff
changeset
|
11 |
.. #. comparison with lists |
8c35d7977f04
Slides for tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
232
diff
changeset
|
12 |
.. #. why are they needed |
8c35d7977f04
Slides for tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
232
diff
changeset
|
13 |
|
8c35d7977f04
Slides for tuples LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
232
diff
changeset
|
14 |
|
232
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
15 |
.. Prerequisites |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
16 |
.. ------------- |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
17 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
18 |
.. 1. Getting started with lists |
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 |
.. Author : Nishanth Amuluru |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
21 |
Internal Reviewer : |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
22 |
External Reviewer : |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
23 |
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
|
24 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
25 |
Script |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
28 |
Hello friends and welcome to the tutorial on Tuples |
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 |
{{{ Show the slide containing title }}} |
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 |
{{{ Show the slide containing the outline slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
33 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
34 |
In this tutorial, we shall learn |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
35 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
36 |
* what are tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
37 |
* their similarities and dissimilarities with lists |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
38 |
* why are they needed |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
39 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
40 |
Let`s get started by defining a tuple. A tuple is defined by enclosing |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
41 |
parantheses around a sequence of items seperated by commas. It is similar to |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
42 |
defining a list except that parantheses are used instead of square brackets. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
43 |
:: |
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 |
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
|
46 |
t |
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 |
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
|
49 |
accessed by using their position. |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
52 |
t[3] |
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 |
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
|
55 |
|
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
58 |
t[1:5:2] |
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 |
prints the corresponding slice |
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 |
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
|
63 |
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
|
64 |
:: |
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 |
t[2] = "Hello" |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
67 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
68 |
We can see that, it raises an error saying tuple does not support item |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
69 |
assignment. It only implies that tuples are immutable or in simple words, |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
70 |
tuples cannot be changed. |
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 |
But what is the use of tuples!!! |
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 |
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
|
75 |
values. |
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 |
{{{ Pause here and try out the following exercises }}} |
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 |
%% 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
|
80 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
81 |
{{{ continue from paused state }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
82 |
:: |
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 = 5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
85 |
b = 7 |
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 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
88 |
b |
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 |
We define the two values |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
91 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
92 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
93 |
temp = a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
94 |
a = b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
95 |
b = temp |
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 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
98 |
b |
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 |
This is the traditional approach |
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 |
Now let us do it the python way |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
103 |
:: |
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 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
106 |
b |
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, b = b, a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
109 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
110 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
111 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
112 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
113 |
We see that the values are swapped. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
114 |
This idiom works for different datatypes also. |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
117 |
a = 2.5 |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
118 |
b = "hello" |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
119 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
120 |
a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
121 |
b |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
122 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
123 |
Moreover this type of behaviour is straight forward and what you would expect |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
124 |
should happen naturally. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
125 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
126 |
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
|
127 |
tuple packing and unpacking. |
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 |
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
|
130 |
:: |
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 |
5, |
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 |
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
|
135 |
:: |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
136 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
137 |
5, "hello", 2.5 |
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 |
Now it is a tuple with two elements. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
140 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
141 |
So when we are actually typing two or more elements seperated by commas, those |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
142 |
elements are packed and a tuple is made from them. |
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 |
When you type |
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 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
147 |
a, b = b, a |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
148 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
149 |
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
|
150 |
unpacked into the variables a and b. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
151 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
152 |
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
|
153 |
packing and unpacking. |
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 |
{{{ Show summary slide }}} |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
156 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
157 |
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
|
158 |
we have learnt |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
159 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
160 |
* How to define tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
161 |
* 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
|
162 |
* The immutability of tuples |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
163 |
* The value swapping idiom in Python |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
164 |
* packing and unpacking of tuples |
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 |
{{{ Show the "sponsored by FOSSEE" slide }}} |
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 |
#[Nishanth]: Will add this line after all of us fix on one. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
169 |
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
|
170 |
|
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
171 |
Hope you have enjoyed and found it useful. |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
172 |
Thankyou |
da873a5ac918
made the tuples.rst into new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
173 |