[Tutor] reverse a number (was no subject)

alan.gauld@bt.com alan.gauld@bt.com
Mon, 12 Aug 2002 11:29:41 +0100


> To do this without using a string I had to loop through
> the number twice.  The first time to see how many digits,
> the second to actually compute the number.
> 
> It's mighty ugly, but it works.  There must be a better
> way.

length = len(str(number))  # beware of '.' in floats tho'!

That OK???

Alan G.