is_palindrome(Number) ->
String = integer_to_list(Number),
String == lists:reverse(String).
(defun is-palindrome (num)
(setf str (format nil "~a" num))
(equal str (reverse str)))
def is_palindromic(number):
'''return True if the number is a palindrome'''
number = str(number)
return number == number[::-1]
ganas de complicarse...
No hay comentarios.:
Publicar un comentario