added questions and pre-reqs to loops LO.
authorPuneeth Chaganti <punchagan@fossee.in>
Fri, 08 Oct 2010 12:36:28 +0530
changeset 254 c43677920502
parent 253 8a117c6e75f1
child 257 5f2c165b4a3c
child 265 5734d03b026c
added questions and pre-reqs to loops LO.
loops/questions.rst
loops/script.rst
--- a/loops/questions.rst	Fri Oct 08 11:59:48 2010 +0530
+++ b/loops/questions.rst	Fri Oct 08 12:36:28 2010 +0530
@@ -1,17 +1,98 @@
-Objective
----------
+Objective Questions
+-------------------
 
 .. A mininum of 8 questions here. 
 
-1. Question 1
-2. Question 2
-3. Question 3
+1. Braces are used to indicate blocks in Python. True or False?
+
+   Answer: False
+
+#. ``for`` can iterate over 
+   
+   a. list of numbers
+   #. list of strings
+   #. strings
+   #. tuples
+   #. all of the above
+
+.. I was not sure of how to frame this question. Can someone fix it?
+
+   Answer: all of the above
+
+#. ``x = range(20)``. What is x?
+
+   Answer: A list of numbers from 0 to 19. 
+
+#. ``x = range(5, 20)``. What is x?
+
+   Answer: A list of numbers from 5 to 19. 
+
+#. ``x = range(0, 20, 5)``. What is x?
+
+   a. [5, 10, 15, 20]
+   #. [0, 5, 10, 15, 20]
+   #. [0, 5, 10, 15]
+   #. Empty list
+   #. None of the Above
+
+   Answer: [0, 5, 10, 15]
+
+#. ``x = range(20, 5)``. What is x?
+
+   a. [5, 10, 15, 20]
+   #. [0, 5, 10, 15, 20]
+   #. [0, 5, 10, 15]
+   #. Empty list
+   #. None of the Above
+
+   Answer: Empty list
 
+#. ``x = range(20, 5, -1)``. What is x?
 
-Programming
------------
+   Answer: A list of numbers from 20 to 6.
+
+#. What is the output of the following code block?
+   ::
+
+     for i in range(1, 4):
+         for j in range(1, 4):
+             print i * j
+             break
+
+   Answer: 1 to 3 is printed
+
+#. What is the output of the following code block?
+   ::
+
+     for i in range(1, 4):
+         for j in range(1, 4):
+             pass
+             print i * j
+
+   Answer::
+     
+     1
+     2
+     3
+     2
+     4
+     6
+     3
+     6
+     9
+
+#. What is the output of the following code block?
+   ::
+
+     for i in range(1, 4):
+         for j in range(1, 4):
+             continue
+             print i * j
+
+   Answer: Nothing is printed
+
+Larger Questions
+----------------
 
 .. A minimum of 2 questions here. 
 
-1. Programming Assignment 1
-2. Programming Assignment 2
--- a/loops/script.rst	Fri Oct 08 11:59:48 2010 +0530
+++ b/loops/script.rst	Fri Oct 08 12:36:28 2010 +0530
@@ -1,14 +1,20 @@
 .. Objectives
 .. ----------
 
-.. Clearly state the objectives of the LO (along with RBT level)
+.. By the end of this tutorial, you will be able to
+
+.. 1. use the ``for`` loop 
+.. #. use the ``while`` loop
+.. #. Use ``break``, ``continue`` and ``pass`` statements to play around
+..    with loops.
 
 .. Prerequisites
 .. -------------
 
-..   1. Name of LO-1
-..   2. Name of LO-2
-..   3. Name of LO-3
+.. 1. getting started with ipython
+.. #. getting started with for
+.. #. conditionals
+
      
 .. Author              : 
    Internal Reviewer   :