Skip to content

Instantly share code, notes, and snippets.

@naveen521kk
Created October 1, 2019 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naveen521kk/cfc5ab63c4ddad06b8acf60cc3273ded to your computer and use it in GitHub Desktop.
Save naveen521kk/cfc5ab63c4ddad06b8acf60cc3273ded to your computer and use it in GitHub Desktop.
To check palindrome loops.
#To check whether a string is a palindrome or not.
s=input('Enter a word')
l=len(s)
mid=l//2
rev=-1
for a in range(l):
if s[a]==s[rev]:
rev-=1
else:
print("not a palindrome")
break
else:
print(s,'Is a palindrome')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment