programming-examples/python/Function/Python function that checks whether a passed string is palindrome or not.py

11 lines
312 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
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('aza'))