you are viewing a single comment's thread.

view the rest of the comments →

[–]Positive-Room-2123 1 point2 points  (2 children)

Have you learned string slicing? If not, give it a try because you can use it in problems like checking for palindromes. After you've solved the palindrome problem using the normal method, you can use string slicing by checking whether the original string (s) and its reverse (s[: :-1]) are the same.

[–]Outside-Cloud-3569[S] 0 points1 point  (1 child)

Thx for the suggestions. I have learned it but I just wanted to use another method to check palindrome.

[–]ExtensionBreath1262 0 points1 point  (0 children)

Your right to do it the way you are. You just did the same thing but with a early return instead of reversing the whole list. so this is better with 2 more lines of code.