Write a Python program to accept a string and check if the given string is a palindrome.

ICSE Class 10 Robotics & AI PYQ · 2025 Paper · Section B

4(iii)Written · 2025 · Section B · 2025 Paper

Write a Python program to accept a string and check if the given string is a palindrome.

Show SolutionHide Solution↓
st = input("Enter a string: ")

if st == st[::-1]:
    print("The given string is a palindrome")
else:
    print("The given string is not a palindrome")
Enter a string: madam
The given string is a palindrome


Enter a string: hello
The given string is not a palindrome
← Previous questionNext question →

Browse the free Robotics & AI sample bank