Skip to content

Commit 722817f

Browse files
authored
Add Recursive check for palindrome (#57)
Add Recursive check for palindrome Co-authored-by: Abraham Hernandez <abraham@abranhe.com>
2 parents 6d2ad66 + d981917 commit 722817f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

strings/recursive_palindrome.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def checkString(string):
2+
string = string.lower()
3+
if(len(string) > 2):
4+
if(string[0] == string[-1]):
5+
return checkString(string[1 : -1])
6+
else:
7+
return False
8+
else: return string[0] == string[-1]
9+
10+
print(checkString(input("check word for palindrome: ")))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy