diff -r fc71d5c27ce6 -r 8a42b4203f6d getting-started-with-lists/script.rst.orig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/getting-started-with-lists/script.rst.orig Tue Nov 09 15:40:53 2010 +0530 @@ -0,0 +1,361 @@ + + + + + + + + + + +
+ + +
+

Objective Questions

+ +
    +
  1. How do you create an empty list?

    +
    +empty=[]
    +
    +
  2. +
  3. What is the most important property of sequence data types like lists?

    +

    The elements are in order and can be accessed by index numbers.

    +
  4. +
  5. Can you have a list inside a list ?

    +

    Yes,List can contain all the other data types, including list.

    +

    Example: +list_in_list=[2.3,[2,4,6],'string,'all datatypes can be there']

    +
  6. +
  7. What is the index number of the first element in a list?

    +

    0 +nonempty = ['spam', 'eggs', 100, 1.234] +nonempty[0]

    +
  8. +
  9. How would you access the end of a list without finding its length?

    +

    Using negative indices. We can the list from the end using negative indices.

    +

    :: +nonempty = ['spam', 'eggs', 100, 1.234] +nonempty[-1]

    +
  10. +
  11. What is the function to find the length of a list?

    +

    len

    +
  12. +
  13. Delete the last element from list sq=[5,4,3,2,1,0]

    +

    del(sq[-1])

    +
  14. +
  15. How many will you have to use remove function to remove all 6's from the given list sq=[2,5,6,7,6,4,6]?

    +

    3

    +
  16. +
+
+
+

Larger Questions

+ +

1. Add all elemets of seq1=['e','f','g','h'] +to the sequence seq=['a','b','c','d']

+
    +
  1. Delete all elements of seq1=[3,5,6] from sequence +seq=[1,2,3,4,5,6,7,8,9]
  2. +
+
+
+ +