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

 
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to