# HG changeset patch # User Puneeth Chaganti # Date 1289424956 -19800 # Node ID 3a1575a45152ed66bebc7199531e50a9ec806cd6 # Parent 757418fff17045dd91fd2519c0bfdd7d8648a51a Added question to loops. diff -r 757418fff170 -r 3a1575a45152 loops/questions.rst --- 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``.