s = "abccba" left = 0 right = len(s) - 1 result = True while left < right: if s[left] != s[right]: result = False break else: left += 1 right -= 1 print(result)
To embed this project on your website, copy the following code and paste it into your website's HTML: