changes progress file
authoramit
Thu, 23 Sep 2010 12:51:32 +0530
changeset 203 846d71a4e915
parent 202 069d4e86207e (diff)
parent 199 680a0692529f (current diff)
child 204 65e5e2362bc9
changes progress file
getting_started_with_for.rst
progress.org
--- a/basicdatatype.rst	Thu Sep 23 12:31:57 2010 +0530
+++ b/basicdatatype.rst	Thu Sep 23 12:51:32 2010 +0530
@@ -10,15 +10,10 @@
  * Operators with a little hands-on on how they can be applied to 
    the different data types.
 
-Since this a hands on session, you will require python installed in your 
-computer. 
-.. #[Nishanth]: this line is not required
+
 
 First we will explore python data structures in the domain of numbers.
-There are three built-in data structures in python to represent numbers.
-
-.. #[Nishanth]: Did you mean data types when you said data structures??
-                Data structures is used for lists and others.
+There are three built-in data types in python to represent numbers.
 
 {{{ A slide to make a memory note of this }}}
 
@@ -31,12 +26,12 @@
 Lets first talk about integers. ::
 
    a = 13
+   a
 
-.. #[Nishanth]: give a space before and after the = sign
 
 Thats it, there we have our first integer variable a.
 
-.. #[Nishanth]: Show the value of a
+
 
 If we now see ::
      
@@ -49,7 +44,7 @@
 
   a.<Tab>
 
-.. #[Nishanth]: a.<Tab> is not a good idea for int or float
+
 
 Lets see the limits of this int.
 
@@ -81,21 +76,16 @@
 format. There is always an aproximationation. This is why we should
 never rely on equality of floating point numbers in a program.
 
-The last data structure in the list is complex number ::
+The last data type in the list is complex number ::
 
   c = 3.2+4.6j
 
 as simple as that so essentialy its just a combination of two floats the 
-imaginary part being define by j notation usually used in electrical 
-engineering. Complex numbers have a lot of functions specific to them.
+imaginary part being define by j notation instead of i. Complex numbers have a lot of functions specific to them.
 Lets check these ::
 
   c.<Tab>
 
-.. #[Nishanth]: rephrase the "j used in electrical engineering"
-                Its ok if you skip it also. Just say that here
-                j is used and not i
-
 Lets try some of them ::
 
   c.real
@@ -118,14 +108,13 @@
 You can apply different Boolean operations on t now for example ::
 
   f = not t 
-  In[]: f
-  In[]: f or t
-  In[]: f and t 
+  f
+  f or t
+  f and t 
 
-.. #[Nishanth]: remove In[]: and include spaces before and after = symbol
-                I don't want to edit it everywhere in the script
+
   
-The results explanotary in themselves.
+The results are explanotary in themselves.
 
 The usage of boolean brings us to an interesting question of precendence.
 What if you want to apply one operator before another. 
@@ -143,13 +132,13 @@
 
 one ::
  
-  In[]: (a and b) or c
+  (a and b) or c
  
 This expression gives the value True
 
 where as the expression :: 
   
-  In[]: a and (b or c) 
+  a and (b or c) 
 
 gives the value False.
 
@@ -170,9 +159,10 @@
 
 We create our first list by typing :: 
   
-  In[]: num = [1, 2, 3, 4]
+  num_list = [1, 2, 3, 4]
+  num_list
 
-.. #[Nishanth]: Show the value of the variable 
+
 Items enclosed in square brackets separated by comma 
 constitutes a list.
 
@@ -180,19 +170,19 @@
 
 We can have a list something like ::
 
- In[]: var = [1, 1.2, [1,2]]	
+ var_list = [1, 1.2, [1,2]]	
+ var_list
 
-.. #[Nishanth]: Show the value of the variable 
-print var
+
 
 Now we will have a look at strings 
 
 type :: 
 
- In[]: w="hello"
+ In[]: greeting_string="hello"
 
-.. #[Nishanth]: Show the value of the variable 
-w is now a string variable with the value "hello"
+
+greeting_string is now a string variable with the value "hello"
 
 {{{ Memory Aid Slide }}}
 
@@ -212,7 +202,7 @@
 To create a tuple  we use normal brackets '('
 unlike '[' for lists.::
 
-  In[]: t = (1, 2, 3, 4, 5, 6, 7, 8)
+  In[]: num_tuple = (1, 2, 3, 4, 5, 6, 7, 8)
   
 Because of their sequential property there are certain functions and 
 operations we can apply to all of them. 
@@ -223,53 +213,54 @@
 
 They can be accessed using index numbers ::
 
-  In[]: num[2]
-  In[]: num[-1]
-  In[]: w[1]
-  In[]: w[3]
-  In[]: w[-2]
-  In[]: t[2]
-  In[]: t[-3]
+  In[]: num_list[2]
+  In[]: num_list[-1]
+  In[]: greeting_string[1]
+  In[]: greeting_string[3]
+  In[]: greeting_string[-2]
+  In[]: num_tuple[2]
+  In[]: num_tuple[-3]
 
-Negative indices can be used to access in reverse
 
-.. #[Nishanth]: Elaborate on indexing.
-                Indexing starts from 0 when moving from left to right
-                Indexing starts from -1 when moving from right to left
+Indexing starts from 0 from left to right and from -1 when accessing
+lists in reverse. Thus num_list[2] refers to the third element 3. 
+and greetings [-2] is the second element from the end , that is 'l'. 
+
+
 
 Addition gives a new sequence containing both sequences ::
 
-     In[]: num+var
-     In[]: p="another string"
-     In[]: w+p
+     In[]: num_list+var_list
+     In[]: a_string="another string"
+     In[]: greeting_string+a_string
      In[]: t2=(3,4,6,7)
-     In[]: t+t2
+     In[]: num_tuple+t2
 
 len function gives the length  ::
 
-  In[]: len(num)
-  In[]: len(w)
-  In[]: len(t)
+  In[]: len(num_list)
+  In[]: len(greeting_string)
+  In[]: len(num_tuple)
 
 Prints the length the variable.
 
 We can check the containership of an element using the 'in' keyword ::
 
-  In[]: 3 in num
-  In[]: 'H' in w
-  In[]: 2 in t
+  In[]: 3 in num_list
+  In[]: 'H' in greeting_string
+  In[]: 2 in num_tuple
 
 We see that it gives True and False accordingly.
 
 Find maximum using max function and minimum using min:: 
 
-  In[]: max(t)
-  In[]: min(w)
+  In[]: max(num_tuple)
+  In[]: min(greeting_string)
 
 Get a sorted list and reversed list using sorted and reversed function ::
 
-  In[]: sorted(num)
-  In[]: reversed(w)
+  In[]: sorted(num_list)
+  In[]: reversed(greeting_string)
 
 As a consequence of the order one we access a group of elements together.
 This is called slicing and striding.
@@ -287,8 +278,8 @@
   In[]: j[1:4]
 
 The syntax for slicing is sequence variable name square bracket
-first element index, colon, second element index.::
-.. #[nishanth]: specify that the last element is not included
+first element index, colon, second element index.The last element however is notincluded in the resultant list::
+
 
   In[]: j[:4]
 
@@ -305,9 +296,9 @@
 
 Lets see by example ::
 
-  In[]: z=[1,2,3,4,5,6,7,8,9,10]
-  In[]: z[1:8:2]
-  Out[]:[2, 4, 6, 8]
+  new_num_list=[1,2,3,4,5,6,7,8,9,10]
+  new_num_list[1:8:2]
+  [2, 4, 6, 8]
 
 The colon two added in the end signifies all the alternate elements. This is why we call this concept
 striding because we move through the list with a particular stride or step. The step in this example
@@ -316,62 +307,54 @@
 We have talked about many similar features of lists, strings and tuples. But there are many important
 features in lists that differ from strings and tuples. Lets see this by example.::
 
-  In[]: z[1]=9
-  In[]: w[1]='k'
+  In[]: new_num_list[1]=9
+  In[]: greeting_string[1]='k'
 
 {{{ slide to show the error }}}
 
-.. #[Nishanth]: Use sensible variable names. At this point no one will remember
-                that z is a list and w is tuple.
-                for example you can use names like some_list, a_tuple etc.
-                or you can also use l for list, t for tuple and s for string
+
 
 As you can see while the first command executes with out a problem there is an error on the second one.
   
 Now lets try ::
 
-  In[]: t[1]=5
+  In[]: new_tuple[1]=5
 
 Its the same error. This is because strings and tuples share the property of being immutable.
 We cannot change the value at a particular index just by assigning a new value at that position.
 
-In case of strings we have special functions to appy relacement and other things while tuples cannot
-be changed at all. 
-
-.. #[Nishanth]: Even in strings also the special functions do not modify the
-                original string. A new string is created instead. These have 
-                been provided for string manipulation.
-                hence I don't think you have to mention this.
 
 We have looked at different types but we need to convert one data type into another. Well lets one
 by one go through methods by which we can convert one data type to other:
 
 We can convert all the number data types to one another ::
 
-  In[]: i=34
-  In[]: d=float(i)
+  i=34
+  d=float(i)
+  d  
 
 Python has built in functions int, float and complex to convert one number type
 data structure to another.
 
-  In[]: dec=2.34
-  In[]: dec_con=int(dec)
-  
-.. #[Nishanth]: Show the value of the variables
+  dec=2.34
+  dec_con=int(dec)
+  dec_con
+
 
 As you can see the decimal part of the number is simply stripped to get the integer.::
 
-  In[]: com=2.3+4.2j
-  In[]: float(com)
+  com=2.3+4.2j
+  float(com)
+  com
 
 In case of complex number to floating point only the real value of complex number is taken.
 
 Similarly we can convert list to tuple and tuple to list ::
   
-  In[]: lst=[3,4,5,6]
-  In[]: tup=tuple(lst)
-  In[]: tupl=(3,23,4,56)
-  In[]: lst=list(tuple)
+  lst=[3,4,5,6]
+  tup=tuple(lst)
+  tupl=(3,23,4,56)
+  lst=list(tuple)
 
 However string to list and list to string is an interesting problem.
 Lets say we have a string ::
@@ -379,7 +362,6 @@
   In: somestring="Is there a way to split on these spaces."
   In: somestring.split()
 
-.. #[Nishanth]: Did you try list(somestring). What does it give??
 
 This produces a list with the string split at whitespace.
 similarly we can split on some other character.
--- a/getting_started_with_for.rst	Thu Sep 23 12:31:57 2010 +0530
+++ b/getting_started_with_for.rst	Thu Sep 23 12:51:32 2010 +0530
@@ -18,7 +18,7 @@
 
 {{{ switch to next slide, outline slide }}}
 
-In this tutorial we will see ``for`` loops in python, and also cover
+In this tutorial we will learn about ``for`` loops in python, and also cover
 the basics of indenting code in python.
 
 .. #[Nishanth]: Instead of saying basics of indenting code,
@@ -38,6 +38,9 @@
                 advantages like neat code can be told after completely
                 explaining the indentation
 
+.. #[Amit]: Do you want to do that here. May be its better to talk about 
+   this after some initiation into the idea of blocks. 
+
 A block may be defined by a suitable indentation level which can be
 either be a tab or few spaces. And the best practice is to indent the
 code using four spaces.
@@ -264,11 +267,19 @@
 Python, indentation, blocks in IPython, for loop, iterating over a
 list and then the ``range()`` function.
 
+.. #[Amit]: There does seem to too much overhead of details. Should
+            the first example be done using script is it necessary. 
+	    Do add some things in evolutionary manner. Like introducing 
+	    range as a list and doing a very very simple for loop.Like
+	    iterating over [1,2,3] .Before getting into a problem.
+	    And club details about problem in one paragraph and syntactic details
+	    in other.
+
 {{{ switch to next slide, thank you slide }}}
 
 Thank you!
 
 ..  Author: Anoop Jacob Thomas <anoop@fossee.in>
     Reviewer 1: Nishanth
-    Reviewer 2:
+    Reviewer 2: Amit Sethi
     External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting_started_with_lists.rst	Thu Sep 23 12:51:32 2010 +0530
@@ -0,0 +1,138 @@
+Hello friends and welcome to the tutorial on getting started with
+lists.
+
+ {{{ Show the slide containing title }}}
+
+ {{{ Show the slide containing the outline slide }}}
+
+In this tutorial we will be getting acquainted with a python data
+structure called lists.  We will learn :
+ * How to create lists
+ * Structure of lists
+ * Access list elements
+ * Append elements to lists
+ * Deleting 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 there order has a meaning.
+
+We will first create an empty list with no elements. On your IPython
+shell type ::
+
+   empty = [] 
+   type(empty)
+   
+
+This is an empty list without any elements.
+
+* Filled lists
+
+Lets now define a list, nonempty and fill it with some random elements.
+
+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 have the same data type.
+
+
+
+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
+integer and float. Thus we can put elements of heterogenous types in
+lists. Thus list themselves can be one of the element types possible
+in lists. Thus lists can also contain other lists.  Example ::
+
+      list_in_list=[[4,2,3,4],'and', 1, 2, 3, 4]
+
+We access list elements using the number of 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.::
+
+	    nonempty[0] 
+	    nonempty[1] 
+	    nonempty[3]
+
+We can also access the elememts from the end using negative indices ::
+   
+   nonempty[-1] 
+   nonempty[-2] 
+   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.
+
+
+
+
+We can append elements to the end of a list using append command. ::
+
+   nonempty.append('onemore') 
+   nonempty
+   nonempty.append(6) 
+   nonempty
+   
+As we can see non empty appends 'onemore' and 6 at the end.
+
+
+
+Using len function we can check the number of elements in the list
+nonempty. In this case it being 6:
+	 
+	 len(nonempty)
+
+
+
+Just like we can append elements to a list we can also remove them.
+There are two ways of doing it. One is by using index. ::
+
+      del(nonempty[1])
+
+
+
+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 :: 
+      
+      a.remove(100)
+
+but what if their were two 100's. To check that lets do a small
+experiment. ::
+
+	   a.append('spam') 
+	   a 
+	   a.remove('spam') 
+	   a
+
+If we check a now we will see that the first occurence 'spam' is removed
+thus remove removes the first occurence of the element in the sequence
+and leaves others untouched.
+
+
+{{{Slide for Summary }}}
+
+
+In this tutorial we came across a sequence data type called lists. ::
+
+ * We learned how to create lists.  
+ * Append elements to list.
+ * Delete Element from list.  
+ * And Checking list length.
+
+
+
+{{{ Sponsored by Fossee Slide }}}
+
+This tutorial was created as a part of FOSSEE project.
+
+I hope you found this tutorial useful.
+
+Thank You
+
+
+Author : Amit Sethi 
+First Reviewer : 
+Second Reviewer : Nishanth
--- a/liststart.rst	Thu Sep 23 12:31:57 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-.. #[Nishanth]: liststart is not a good name. there is no consistency.
-                Use underscores or hyphens instead of spaces and 
-                make the filename from LO name
-                Ex: getting_started_with_lists (or)
-                getting_started_lists
-
-Hello friends and welcome to the tutorial on getting started with
-lists.
-
- {{{ Show the slide containing title }}}
-
- {{{ Show the slide containing the outline slide }}}
-
-In this tutorial we will be getting acquainted with a python data
-structure called lists.  We will learn :
- * How to create lists
- * Structure of lists
- * Access list elements
- * Append elements to lists
- * Deleting elements from lists
-
-.. #[Nishanth]: Did you compile this??
-                There must an empty before the bulleted list
-
-I hope you have ipython running on your system.
-
-.. #[Nishanth]: need not specify. Implicit that IPython is running
-
-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 there order has a meaning.
-
-We will first create an empty list with no elements. On your IPython
-shell type ::
-
-   empty = [] 
-   type(empty)
-   
-
-This is an empty list without any elements.
-
-* Filled lists
-
-Lets now define a list, nonempty and fill it with some random elements.
-
-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 have the same data type.
-
-.. #[Nishanth]: do not use "You" or anything else. Stick to "We"
-
-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
-integer and float. Thus we can put elements of heterogenous types in
-lists. Thus list themselves can be one of the element types possible
-in lists. Thus lists can also contain other lists.  Example ::
-
-      list_in_list=[[4,2,3,4],'and', 1, 2, 3, 4]
-
-We access list elements using the number of 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.::
-
-	    nonempty[0] 
-	    nonempty[1] 
-	    nonempty[3]
-
-We can also access the elememts from the end using negative indices ::
-   
-   nonempty[-1] 
-   nonempty[-2] 
-   nonempty[-4]
-
--1 being the last element , -2 second to last and -4 being the first
-element.
-
-.. #[Nishanth]: -1 being last element sounds like -1 is the last element
-                Instead say -1 gives the last element which is 4
-
-.. #[Nishanth]: Instead of saying -4 being the first, say -4 gives 4th 
-                from the last which is the first element.
-
-* =append= elements 
-We can append elements to the end of a list using append command. ::
-
-   nonempty.append('onemore') 
-   nonempty.append(6) 
-   nonempty
-   
-As we can see non empty appends 'onemore' and 6 at the end.
-
-.. #[Nishanth]: First show an example with only one append.
-                may be show the value of a after first append
-                then show what happens after second append 
-
-Using len function we can check the number of elements in the list
-nonempty. Because we just appended two elements at the end this
-returns us 6.::
-	 
-	 len(nonempty)
-
-.. #[Nishanth]: the "because ..." can be removed. You can simply
-                say len gives the no.of elements which is 6 here
-
-Just like we can append elements to a list we can also remove them.
-There are two ways of doing. One is by using index. ::
-
-      del(nonempty[1])
-
-.. #[Nishanth]: do not use "You" or anything else. Stick to We
-
-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 :: 
-      
-      a.remove(100)
-
-but what if their were two 100's. To check that lets do a small
-experiment. ::
-
-	   a.append('spam') 
-	   a 
-	   a.remove('spam') 
-	   a
-
-If we check a now we will see that the first occurence 'spam' is removed
-thus remove removes the first occurence of the element in the sequence
-and leaves others untouched.
-
-
-{{{Slide for Summary }}}
-
-
-In this tutorial we came across a sequence data type called lists. ::
-
- * We learned how to create lists.  
- * Append elements to list.
- * Delete Element from list.  
- * And Checking list length.
-
-.. #[Nishanth]: See the diff. I have corrected punctuation in many places.
-                The first thing you do before committing is compile the script.
-                I have corrected syntax errors also in many places.
-
-{{{ Sponsored by Fossee Slide }}}
-
-This tutorial was created as a part of FOSSEE project.
-
-I hope you found this tutorial useful.
-
-Thank You
-
-
-Author : Amit Sethi 
-First Reviewer : 
-Second Reviewer : Nishanth
--- a/progress.org	Thu Sep 23 12:31:57 2010 +0530
+++ b/progress.org	Thu Sep 23 12:51:32 2010 +0530
@@ -14,7 +14,7 @@
 | 2.5 LO: | module level assessment                |     3 | Nishanth |                     |                     |
 |---------+----------------------------------------+-------+----------+---------------------+---------------------|
 | 3.1 LO: | getting started with lists             |     2 | Amit     | Madhu (Pending)     | Nishanth (Done)     |
-| 3.2 LO: | getting started with =for=             |     2 | Anoop    | Nishanth (Done)     | Amit (Pending)      |
+| 3.2 LO: | getting started with =for=             |     2 | Anoop    | Nishanth (Done)     | Amit (Done)         |
 | 3.3 LO: | getting started with strings           |     2 | Madhu    |                     |                     |
 | 3.4 LO: | getting started with files             |     3 | Punch    |                     |                     |
 | 3.5 LO: | parsing data                           |     3 | Nishanth | Amit (Done)         | Punch (Pending)     |