day1/exercise/collatz.py
author Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
Mon, 28 Jun 2010 00:14:02 -0500
branchscipy2010
changeset 426 7d8738ce004d
parent 425 5afcfce15e71
permissions -rw-r--r--
Adding an acknowledgement slide to session 1. Minor changes to session 2.

num = int( raw_input( 'Enter number: ') )
while num != 4:
    print num,
    if num % 2 == 1:
        num = num * 3 + 1
    else:
        num /= 2
print 4, 2, 1