Write a Python function that checks whether a passed string is palindrome or not
I have used python 3.7 compiler for debugging purpose.
def isPalindrome(string): left_pos = 0 right_pos = len(string) - 1 while right_pos >= left_pos: if not string[left_pos] == string[right_pos]: return False left_pos += 1 right_pos -= 1 return True print(isPalindrome('12121'))
Result:
True
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used python 3.7 compiler for debugging purpose.
Result:
True
need an explanation for this answer? contact us directly to get an explanation for this answer