mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-08 03:00:37 +00:00
14 lines
289 B
Python
14 lines
289 B
Python
def is_palindrom(word) -> bool:
|
|
word = list(word)
|
|
if len(word) < 2:
|
|
return True
|
|
if word[0] == word[-1]:
|
|
word.pop(0)
|
|
word.pop(-1)
|
|
return is_palindrom(word)
|
|
else:
|
|
return False
|
|
|
|
|
|
print(is_palindrom("do geese see god".replace(" ", "")))
|