Facebook
From palindrom, 4 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 213
  1. def is_palindrome(s):
  2.     return s == s[::-1]
  3.  
  4. string1 = "Hello"
  5. string2 = "level"
  6.  
  7. if is_palindrome(string1):
  8.     print(f"{string1} is a palindrome.")
  9. else:
  10.     print(f"{string1} is not a palindrome.")
  11.  
  12. if is_palindrome(string2):
  13.     print(f"{string2} is a palindrome.")
  14. else:
  15.     print(f"{string2} is not a palindrome.")
  16.