author | Santosh G. Vattam <vattam.santosh@gmail.com> |
Mon, 22 Feb 2010 14:32:01 +0530 | |
changeset 373 | f04eca8b2f3d |
parent 354 | 5dc6c3673f9d |
child 386 | a0bec380b44f |
permissions | -rw-r--r-- |
354
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
64
diff
changeset
|
1 |
a = int( raw_input( 'Enter number: ') ) |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
64
diff
changeset
|
2 |
while a != 4: |
64
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
print a |
354
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
64
diff
changeset
|
4 |
if a % 2 == 1: |
64
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
a = a * 3 + 1 |
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
else: |
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
a /= 2 |
354
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
64
diff
changeset
|
8 |
print 4 |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
64
diff
changeset
|
9 |
print 2 |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
64
diff
changeset
|
10 |
print 1 |