Breaking a three-digit integer. Is this a good way?

Started by
49 comments, last by Cecil_PL 15 years, 9 months ago
This is why I love python.

#splits a number into a list of digitsdef split_number(n):    return list(str(n))#returns whether n is a palindromedef is_palindrome(n):    return (str(n) == str(n)[::-1])

This topic is closed to new replies.

Advertisement