Aditya Lal wrote:

> def rev(n) :
>     m = 0
>     while n > 0 :
>         m = m*10 + n%10
>         n = n/10
>     return m

I would try reversing the numbers as strings. s[::-1] will reverse a 
string s.

> How do I improve the input reading or string parsing ? I know there 
> should be a better way because the best program (at cost of memory) 
> performs > 50% faster than mine. So he must have done something to 
> improve input processing.

The programs that use a lot of memory are using psyco.

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to