diff -r e78c284d644b -r 223044cf254f getting-started-with-lists/questions.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/getting-started-with-lists/questions.rst Wed Oct 13 17:10:38 2010 +0530 @@ -0,0 +1,47 @@ +Objective Questions +------------------- + +.. A mininum of 8 questions here (along with answers) + +1. How do you create an empty list? :: + + empty=[] + +2. What is the most important property of sequence data types like lists? + + The elements are in order and can be accessed by index numbers. + +3. 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'] + +4. What is the index number of the first element in a list? + + 0 + nonempty = ['spam', 'eggs', 100, 1.234] + nonempty[0] + +5. 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] + +6. What is the function to find the length of a list? + + len + + 7. + +Larger Questions +---------------- + +.. A minimum of 2 questions here (along with answers) + +1. Question 1 +2. Question 2