On Thu, Oct 25, 2012 at 2:00 PM, Neil Cerutti <ne...@norwich.edu> wrote: > Yes indeed! Python string operations are fast enough and its > arithmetic slow enough that I no longer assume I can beat a neat > lexicographical solution. Try defeating the following with > arithmetic: > > def is_palindrom(n): > s = str(n) > return s = s[::-1]
Problems like these are fundamentally string problems, not math problems. The question being asked isn't about some essential property of the number, but about its digital representation. Certainly they can be reasoned about mathematically, but the fact remains that the math being done is about the properties of strings. -- http://mail.python.org/mailman/listinfo/python-list