getting-started-with-lists/script.rst
changeset 521 88a01948450d
parent 491 ebfe3a675882
--- a/getting-started-with-lists/script.rst	Wed Nov 17 23:24:23 2010 +0530
+++ b/getting-started-with-lists/script.rst	Wed Nov 17 23:24:57 2010 +0530
@@ -22,7 +22,8 @@
 .. Author              : Amit 
    Internal Reviewer   : Anoop Jacob Thomas <anoop@fossee.in>
    External Reviewer   :
-   Checklist OK?       : <put date stamp here, if OK> [2010-10-05]
+   Language Reviewer   : Bhanukiran
+   Checklist OK?       : <12-11-2010, Anand, OK> [2010-10-05]
 
 .. #[[Anoop: Slides contain only outline and summary
 
@@ -44,9 +45,9 @@
  * Append elements to lists
  * Delete elements from lists
 
-List is a compound data type, it can contain data of other data
-types. List is also a sequence data type, all the elements are in
-order and the order has a meaning.
+List is a compound data type, it can contain data of mutually
+different datatypes. List is also a sequence data type, all the
+elements are arranged in a given order.
 
 .. #[[Anoop: "all the elements are in order and **there** order has a
    meaning." - I guess something is wrong here, I am not able to
@@ -69,13 +70,13 @@
      nonempty = ['spam', 'eggs', 100, 1.234]
 
 Thus the simplest way of creating a list is typing out a sequence 
-of comma-separated values (items) between square brackets. 
-All the list items need not be of the same data type.
+of comma-separated values (or items) between two square brackets. 
 
 As we can see lists can contain different kinds of data. In the
-previous example 'spam' and 'eggs' are strings and 100 and 1.234 are
-integer and float. Thus we can put elements of heterogenous types in
-lists including list itself.
+previous example 'spam' and 'eggs' are strings whereas 100 and 1.234 are
+integer and float respectively. Thus we can put elements of different types in
+lists including lists itself. This property makes lists heterogeneous
+data structures.
 
 .. #[[Anoop: the sentence "Thus list themselves can be one of the
    element types possible in lists" is not clear, rephrase it.]]
@@ -84,9 +85,10 @@
 
       listinlist=[[4,2,3,4],'and', 1, 2, 3, 4]
 
-We access list elements using the index. The index begins from 0. So
-for list nonempty, nonempty[0] gives the first element, nonempty[1]
-the second element and so on and nonempty[3] the last element. ::
+We access an element of a list using its corresponding index. Index of
+the first element of a list is 0. So for the list nonempty, nonempty[0] 
+gives the first element, nonempty[1] the second element and so on and 
+nonempty[3] the last element. ::
 
 	    nonempty[0] 
 	    nonempty[1] 
@@ -112,9 +114,9 @@
    nonempty[-4]
 
 -1 gives the last element which is the 4th element , -2 second to last
-and -4 gives the fourth from last element which is first element.
+and -4 gives the fourth from the last which, in this case,  is the first element.
 
-We can append elements to the end of a list using append command. ::
+We can append elements to the end of a list using the method append. ::
 
    nonempty.append('onemore') 
    nonempty
@@ -134,10 +136,10 @@
 The solution is on your screen
 
 
-As we can see non empty appends 'onemore' and 6 at the end.
+As we can see nonempty is appended with 'onemore' and 6 at the end.
 
 Using len function we can check the number of elements in the list
-nonempty. In this case it 6 ::
+nonempty. In this case it is 6 ::
 	 
 	 len(nonempty)
 
@@ -153,7 +155,7 @@
 deletes the element at index 1, i.e the second element of the
 list, 'eggs'. The other way is removing element by content. Lets say
 one wishes to delete 100 from nonempty list the syntax of the command
-should be 
+would be 
 
 .. #[[Anoop: let x = [1,2,1,3]
    	     now x.remove(x[2])
@@ -175,9 +177,25 @@
 	   nonempty
 
 If we check now we will see that the first occurence 'spam' is removed
-thus remove removes the first occurence of the element in the sequence
+and therefore `remove` removes the first occurence of the element in the sequence
 and leaves others untouched.
 
+One should remember this that while del removes by index number,
+`remove` removes on the basis of content being passed on. For instance
+if ::
+       
+       k = [1,2,1,3] 
+       del([k[2])
+
+gives us [1,2,3]. ::
+
+      k.remove(x[2])
+
+will give us [2,1,3]. Since it deletes the first occurence of what is
+returned by x[2] which is 1.      
+
+
+