# L-12 MCS 260 Mon 8 Feb 2010 : binary expansion # This first version prints the bits # in the order as they are computed. # We use divmod(), an intrinsic operation # on numeric types. print 'computing the binary expansion' n = input('Give a number : ') (n,r) = divmod(n,2) print r while n > 0: (n,r) = divmod(n,2) print r