Skip to content

Instantly share code, notes, and snippets.

@ashokbharat
Created May 29, 2017 11:21
Show Gist options
  • Save ashokbharat/34cc917d0d283a9fc1bf19cfde1290b8 to your computer and use it in GitHub Desktop.
Save ashokbharat/34cc917d0d283a9fc1bf19cfde1290b8 to your computer and use it in GitHub Desktop.
palindrome String
'''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