Skip to content

Instantly share code, notes, and snippets.

@jatinsharrma
Created April 18, 2020 22:01
Show Gist options
  • Save jatinsharrma/4667fbfad1b7c163620a143814cccfe1 to your computer and use it in GitHub Desktop.
Save jatinsharrma/4667fbfad1b7c163620a143814cccfe1 to your computer and use it in GitHub Desktop.
Palindrome Check
#-------------------------------------------
#------------Palindrome---------------------
#-------------------------------------------
# this function check whether given string is palindrome or not
def palindrome(string):
length = len(string)
mid = length//2
for i in range(mid):
if string[i] != string[length -1 -i]:
return False
return True
# testing
print(palindrome("naman"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment