Day 37 of 100 Days of Python
Practising Recursion
1
2
3
4
5
6
7
8
9
10
11
# To check Palindrome
def is_palindrome(str):
if len(str)<=1:
return True
if str[0] != str[-1]:
return False
return is_palindrome(str[1:-1])
print(is_palindrome("racecar"))
This post is licensed under CC BY 4.0 by the author.