# L-6.5 MCS 260 Friday 27 June 2014 : binary expansion
"""
Use of break for repeat until.
The script also shows how to avoid a line break
when printing the bits in the expansion.
"""
print 'computing the binary expansion'
NRAW = raw_input('Give a number : ')
N = int(NRAW)
while True:
    (N, R) = divmod(N, 2)
    print R,    # the comma avoids the line break
    if N == 0:
        break
