Sunday, March 3, 2019

Check weather the given string is palindrome or not - Python3

s=input("Enter string:")
a=[]
b=[]
for i in range(len(s)):
    a.append(s[i])
print("list is:",a)
b=a+[]
b.reverse()
print("\nreversed list is",b)
if(b==a):
    print("Entered string is palindrome...")
else:
    print("Entered string is not a palindrome!!!")

ScreenShot:



No comments:

Post a Comment