fork download
  1. # your code goes here
  2. # your code goes here
  3. def isPalindrome(s: str) -> bool:
  4. temp = ""
  5. for i in s.lower():
  6. if "a" <= i <= "z" or "0" <= i <= "9" :
  7. temp = temp + i
  8. l,r = 0 , len(temp) -1
  9. while l<r:
  10. print(l,r,temp[l],temp[r])
  11. print(l,r,temp[l]!=temp[r])
  12. if temp[l] != temp[r]:
  13. return "false"
  14. r = r-1
  15. l = l+1
  16. return "true"
  17.  
  18. print(isPalindrome("race a car"))
Success #stdin #stdout 0.03s 9708KB
stdin
Standard input is empty
stdout
0 7 r r
0 7 False
1 6 a a
1 6 False
2 5 c c
2 5 False
3 4 e a
3 4 True
false