πŸ›

Python programs coding series - plaindrome

Reversing a string and checking whether the string is palindrome or not

#Reversing a string and checking palindrome or not

import string

word = input(β€œEnter the string to be reversed:”) reversed_word=word[::-1] print(β€œThe reverse of β€œ+str(word)+” is β€œ+str(reversed_word))

if word == reversed_word: print(word+” is a palindrome!!!”) else: print(word + ” is not a palindrome!!!”)

Output

Enter the string to be reversed:level The reverse of level is level level is a palindrome!!!