Skip to content

Commit cbf6b9f

Browse files
author
Mamtesh2001
committed
Add is_palindrome function
1 parent af17867 commit cbf6b9f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

strings/is_palindrome.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def is_palindrome(s: str) -> bool:
2+
s = s.lower().replace(" ", "")
3+
return s == s[::-1]
4+
5+
if __name__ == "__main__":
6+
print(is_palindrome("madam")) # True
7+
print(is_palindrome("hello")) # False

0 commit comments

Comments
 (0)