[Tutor] newline problem
Roelof Wobben
rwobben at hotmail.com
Sat Aug 21 20:36:00 CEST 2010
Hello,
I have this programm :
def print_digits(n):
"""
>>> print_digits(13789)
9 8 7 3 1
>>> print_digits(39874613)
3 1 6 4 7 8 9 3
>>> print_digits(213141)
1 4 1 3 1 2 """
count = 0
while n:
count = count + 1
n = n / 10
return count
getal=13789
x=print_digits(getal)
teller=1
while teller <=x :
digit=float(getal/10.0)
digit2=float(digit-int(digit))*10
getal=digit
print int(digit2)
teller=teller+1
But now every digit is placed on another line.
How can I prevent this ?
Roelof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100821/a6d2619e/attachment.html>
More information about the Tutor
mailing list