Created
October 1, 2019 14:08
-
-
Save naveen521kk/cfc5ab63c4ddad06b8acf60cc3273ded to your computer and use it in GitHub Desktop.
To check palindrome loops.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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