Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions String_Palindrome.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Program to check if a string is palindrome or not

my_str = 'aIbohPhoBiA'
my_str = input().strip()

# make it suitable for caseless comparison
my_str = my_str.casefold()

# reverse the string
rev_str = reversed(my_str)
rev_str = my_str[::-1]

# check if the string is equal to its reverse
if list(my_str) == list(rev_str):
if my_str == rev_str:
print("The string is a palindrome.")
else:
print("The string is not a palindrome.")