Advertisement
Guest User

palindrome

a guest
Nov 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def is_palindrome(n):
  2.     if type(n) in (int, str):
  3.         tmp = str(n)
  4.     else:
  5.         print("Works on strings and integers only!")
  6.     if tmp == tmp[::-1]:
  7.         return True
  8.     return False
  9.    
  10. print(is_palindrome("wow"))
  11. print(is_palindrome(12321))
  12. print(is_palindrome(765))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement