+ 10
[PythonEdu] Recursive palindrome checker
Another example of using recursion, as the algorithm base. Most tutorials mention 'factorial' or 'power of' as examples of recursion. But this can also be used in text-based problematics. The code goes recursively inside a string, by checking for equality of its first and last character, if so, assumes the same string stripped of the first and the last characters for the next iteration... and so on. Note: one-char and empty strings are palindromes by definition :) https://code.sololearn.com/cgtlGQC2E04W/
4 Réponses
+ 11
Hmm...That's recursive power!
Great! Why don't you first take an input from user and then true or false?
Thanks @Kuba
+ 7
Of course that is only for education purposes. There is actually no point in using recursion for palindrome checkup in Python.
A much simpler method:
https://code.sololearn.com/cR4DVjNP4rXd/?ref=app
+ 5
Of course it can be done. But under SL it works crappy :)
+ 2
Hi kuba,
can you please review my code on checking palindromes
https://code.sololearn.com/cm52O60tK6yU/?ref=app