--- a/loops/questions.rst Thu Nov 11 03:00:35 2010 +0530
+++ b/loops/questions.rst Thu Nov 11 03:05:56 2010 +0530
@@ -15,9 +15,10 @@
#. tuples
#. all of the above
+ Answer: all of the above
+
.. I was not sure of how to frame this question. Can someone fix it?
-..#[bhanu: it works for every `sequence` or an iterator for that matter right?]
- Answer: all of the above
+.. #[bhanu: it works for every `sequence` or an iterator for that matter right?]
#. ``x = range(20)``. What is x?
@@ -95,4 +96,7 @@
1. A number is called Armstrong number if the sum of cubes of its digits is
equal to the number itself. Find all the three digit Armstrong numbers.
-.. #[[Anoop: Add one more question]]
+2. Collatz sequence - Given a number ``n``, multiply by 3 and add 1 to
+ it, if it is odd, otherwise divide it by two. With whatever ``n``
+ we start with, we finally end with the sequence 4, 2, 1. Write a
+ program to print this, given some number ``n``.