Advertisement
k1alo

Palindrome

Nov 9th, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. def palindrome(word):
  2.     word = word.lower()
  3.     word = word.replace(" ", "")
  4.     reversed_word = word[::-1]
  5.     return word == reversed_word
  6.  
  7.  
  8. text = "А роза упала на лапу Азора"
  9. if palindrome(text):
  10.     print(f"Строка '{text}' является палиндромом.")
  11. else:
  12.     print(f"Строка '{text}' не является палиндромом.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement