author | Amit Sethi |
Thu, 11 Nov 2010 17:28:23 +0530 | |
changeset 468 | ac1198488c0e |
parent 466 | 00c1ba1cb9ef |
child 490 | 2280bbdce638 |
permissions | -rw-r--r-- |
374 | 1 |
.. Objectives |
2 |
.. ---------- |
|
3 |
||
4 |
.. By the end of this tutorial, you will be able to |
|
5 |
||
6 |
.. Create Lists. |
|
7 |
.. Access List elements. |
|
8 |
.. Append elemets to list |
|
9 |
.. Delete list elemets |
|
10 |
||
11 |
.. 1. getting started with ipython |
|
12 |
||
13 |
||
14 |
||
15 |
.. Prerequisites |
|
16 |
.. ------------- |
|
17 |
||
18 |
.. 1. getting started with strings |
|
19 |
.. #. getting started with lists |
|
20 |
.. #. basic datatypes |
|
21 |
||
415 | 22 |
.. Author : Amit |
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
23 |
Internal Reviewer : Anoop Jacob Thomas <anoop@fossee.in> |
374 | 24 |
External Reviewer : |
25 |
Checklist OK? : <put date stamp here, if OK> [2010-10-05] |
|
26 |
||
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
27 |
.. #[[Anoop: Slides contain only outline and summary |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
28 |
|
374 | 29 |
Script |
30 |
------ |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
31 |
{{{ Show the slide containing title }}} |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
32 |
|
178 | 33 |
Hello friends and welcome to the tutorial on getting started with |
182 | 34 |
lists. |
178 | 35 |
|
36 |
{{{ Show the slide containing the outline slide }}} |
|
37 |
||
38 |
In this tutorial we will be getting acquainted with a python data |
|
204 | 39 |
structure called lists. We will learn :: |
40 |
||
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
41 |
* How to create lists |
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
42 |
* Structure of lists |
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
43 |
* Access list elements |
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
44 |
* Append elements to lists |
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
45 |
* Delete elements from lists |
178 | 46 |
|
182 | 47 |
List is a compound data type, it can contain data of other data |
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
48 |
types. List is also a sequence data type, all the elements are in |
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
49 |
order and the order has a meaning. |
178 | 50 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
51 |
.. #[[Anoop: "all the elements are in order and **there** order has a |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
52 |
meaning." - I guess something is wrong here, I am not able to |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
53 |
follow this.]] |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
54 |
|
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
55 |
We will first create an empty list with no elements. On your IPython |
178 | 56 |
shell type :: |
57 |
||
182 | 58 |
empty = [] |
59 |
type(empty) |
|
178 | 60 |
|
61 |
||
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
62 |
This is an empty list without any elements. |
178 | 63 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
64 |
.. #[[Anoop: the document has to be continous, without any |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
65 |
subheadings, removing * Filled lists]] |
178 | 66 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
67 |
Lets now see how to define a non-empty list. We do it as,:: |
178 | 68 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
69 |
nonempty = ['spam', 'eggs', 100, 1.234] |
178 | 70 |
|
71 |
Thus the simplest way of creating a list is typing out a sequence |
|
72 |
of comma-separated values (items) between square brackets. |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
73 |
All the list items need not be of the same data type. |
178 | 74 |
|
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
75 |
As we can see lists can contain different kinds of data. In the |
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
76 |
previous example 'spam' and 'eggs' are strings and 100 and 1.234 are |
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
77 |
integer and float. Thus we can put elements of heterogenous types in |
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
78 |
lists including list itself. |
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
79 |
|
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
80 |
.. #[[Anoop: the sentence "Thus list themselves can be one of the |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
81 |
element types possible in lists" is not clear, rephrase it.]] |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
82 |
|
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
83 |
Example :: |
178 | 84 |
|
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
85 |
listinlist=[[4,2,3,4],'and', 1, 2, 3, 4] |
178 | 86 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
87 |
We access list elements using the index. The index begins from 0. So |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
88 |
for list nonempty, nonempty[0] gives the first element, nonempty[1] |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
89 |
the second element and so on and nonempty[3] the last element. :: |
178 | 90 |
|
91 |
nonempty[0] |
|
92 |
nonempty[1] |
|
93 |
nonempty[3] |
|
94 |
||
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
95 |
Following is an exercise that you must do. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
96 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
97 |
%% %% What happens when you do nonempty[-1]. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
98 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
99 |
Please, pause the video here. Do the exercise and then continue. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
100 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
101 |
.. #[[Anoop: was negative indices introduced earlier, if not may be we |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
102 |
can ask them to try out nonempty[-1] and see what happens and then |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
103 |
tell that it gives the last element in the list.]] |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
104 |
|
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
105 |
As you can see you get the last element which is 1.234. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
106 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
107 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
108 |
In python negative indices are used to access elements from the end:: |
178 | 109 |
|
110 |
nonempty[-1] |
|
111 |
nonempty[-2] |
|
112 |
nonempty[-4] |
|
113 |
||
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
114 |
-1 gives the last element which is the 4th element , -2 second to last |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
115 |
and -4 gives the fourth from last element which is first element. |
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
116 |
|
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
117 |
We can append elements to the end of a list using append command. :: |
178 | 118 |
|
119 |
nonempty.append('onemore') |
|
201
6b1efb74d914
Applied the suggestion of Nishanth on getting started with lists and basicdatatypes(Partially)
amit
parents:
200
diff
changeset
|
120 |
nonempty |
178 | 121 |
nonempty.append(6) |
122 |
nonempty |
|
123 |
||
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
124 |
Following are exercises that you must do. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
125 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
126 |
%% %% What is the syntax to get the element 'and' |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
127 |
in the list,listinlist ? |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
128 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
129 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
130 |
%% %% How would you get 'and' using negative indices? |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
131 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
132 |
Please, pause the video here. Do the exercise and then continue. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
133 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
134 |
The solution is on your screen |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
135 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
136 |
|
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
137 |
As we can see non empty appends 'onemore' and 6 at the end. |
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
138 |
|
178 | 139 |
Using len function we can check the number of elements in the list |
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
140 |
nonempty. In this case it 6 :: |
178 | 141 |
|
142 |
len(nonempty) |
|
143 |
||
201
6b1efb74d914
Applied the suggestion of Nishanth on getting started with lists and basicdatatypes(Partially)
amit
parents:
200
diff
changeset
|
144 |
|
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
145 |
|
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
146 |
Just like we can append elements to a list we can also remove them. |
201
6b1efb74d914
Applied the suggestion of Nishanth on getting started with lists and basicdatatypes(Partially)
amit
parents:
200
diff
changeset
|
147 |
There are two ways of doing it. One is by using index. :: |
178 | 148 |
|
149 |
del(nonempty[1]) |
|
150 |
||
201
6b1efb74d914
Applied the suggestion of Nishanth on getting started with lists and basicdatatypes(Partially)
amit
parents:
200
diff
changeset
|
151 |
|
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
152 |
|
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
153 |
deletes the element at index 1, i.e the second element of the |
178 | 154 |
list, 'eggs'. The other way is removing element by content. Lets say |
155 |
one wishes to delete 100 from nonempty list the syntax of the command |
|
466
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
156 |
would be |
178 | 157 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
158 |
.. #[[Anoop: let x = [1,2,1,3] |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
159 |
now x.remove(x[2]) |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
160 |
still x is [2,1,3] so that is not the way to remove |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
161 |
element by index, it removed first occurrence of 1(by |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
162 |
content) and not based on index, so make necessary |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
163 |
changes]] |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
164 |
|
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
165 |
:: |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
166 |
|
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
167 |
nonempty.remove(100) |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
168 |
|
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
169 |
but what if there were two 100's. To check that lets do a small |
182 | 170 |
experiment. :: |
178 | 171 |
|
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
172 |
nonempty.append('spam') |
342 | 173 |
nonempty |
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
174 |
nonempty.remove('spam') |
342 | 175 |
nonempty |
178 | 176 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
177 |
If we check now we will see that the first occurence 'spam' is removed |
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
178 |
thus remove removes the first occurence of the element in the sequence |
182 | 179 |
and leaves others untouched. |
178 | 180 |
|
466
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
181 |
One should remember this that while del removes by index number. |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
182 |
Remove , removes on the basis of content being passed so if :: |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
183 |
|
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
184 |
k = [1,2,1,3] |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
185 |
del([k[2]) |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
186 |
|
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
187 |
gives us [1,2,3]. :: |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
188 |
|
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
189 |
k.remove(x[2]) |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
190 |
|
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
191 |
will give us [2,1,3]. Since it deletes the first occurence of what is |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
192 |
returned by x[2] which is 1. |
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
193 |
|
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
194 |
|
00c1ba1cb9ef
Changes in getting started with list. Elaborating some points as suggested in review
Amit Sethi
parents:
441
diff
changeset
|
195 |
|
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
196 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
197 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
198 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
199 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
200 |
.. #[[Anoop: does it have two spams or two pythons?]] |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
201 |
|
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
202 |
.. #[[Anoop: there are no exercises/solved problems in this script, |
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
203 |
add them]] |
178 | 204 |
|
441
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
205 |
Following are exercises that you must do. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
206 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
207 |
%% %% Remove the third element from the list, listinlist. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
208 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
209 |
%% %% Remove 'and' from the list, listinlist. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
210 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
211 |
Please, pause the video here. Do the exercise and then continue. |
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
212 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
213 |
|
430035b678f7
Exercises for getting started with lists and some changes based on review
Amit Sethi
parents:
430
diff
changeset
|
214 |
|
178 | 215 |
{{{Slide for Summary }}} |
216 |
||
217 |
||
185
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
218 |
In this tutorial we came across a sequence data type called lists. :: |
35a3811ca91e
reviewed getting_started_with_lists a.k.a liststart
Nishanth <nishanth@fossee.in>
parents:
182
diff
changeset
|
219 |
|
182 | 220 |
* We learned how to create lists. |
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
208
diff
changeset
|
221 |
* How to access lists. |
182 | 222 |
* Append elements to list. |
223 |
* Delete Element from list. |
|
224 |
* And Checking list length. |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
208
diff
changeset
|
225 |
|
201
6b1efb74d914
Applied the suggestion of Nishanth on getting started with lists and basicdatatypes(Partially)
amit
parents:
200
diff
changeset
|
226 |
|
178 | 227 |
|
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
228 |
{{{ show Sponsored by Fossee Slide }}} |
178 | 229 |
|
230 |
This tutorial was created as a part of FOSSEE project. |
|
231 |
||
232 |
I hope you found this tutorial useful. |
|
233 |
||
234 |
Thank You |
|
235 |
||
430
7b2275daab60
reviewed getting started with lists.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
415
diff
changeset
|
236 |
.. |
208 | 237 |
* Author : Amit Sethi |
238 |
* First Reviewer : |
|
239 |
* Second Reviewer : Nishanth |