Created
May 29, 2017 11:21
-
-
Save ashokbharat/34cc917d0d283a9fc1bf19cfde1290b8 to your computer and use it in GitHub Desktop.
palindrome String
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
'''Ask the user for a string and print out whether this string is a palindrome or not. | |
(A palindrome is a string that reads the same forwards and backwards.)''' | |
s = str(input("Enter a string to check whether this is palindrome or not")) | |
match = True | |
count=-1 | |
for c in s: | |
if c == s[count]: | |
count-=1 | |
continue | |
else: | |
match = False | |
break | |
if(match): | |
print("The string is a palindrome") | |
else: | |
print("The string is not a palindrome") | |
h = "hjdhsdjhs" | |
print(h[::-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment