mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 12:16:14 -04:00
15 lines
283 B
Python
15 lines
283 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
# author: bt3gl
|
|
|
|
def is_palindrome(sentence):
|
|
|
|
sentence = sentence.strip(' ')
|
|
if len(sentence) < 2:
|
|
return True
|
|
|
|
if sentence[0] == sentence[-1]:
|
|
return is_palindrome(sentence[1:-1])
|
|
|
|
return False
|