Professional Documents
Culture Documents
Class Palindrome Python
Class Palindrome Python
@staticmethod
def is_palindrome(word):
return None
word = input()
print(Palindrome.is_palindrome(word))
class Palindrome:
@staticmethod
def is_palindrome(word):
if len(word) <= 1:
return True
else:
if word[0] != word[len(word)-1]:
return False
else:
return is_palindrome(word[1:len(word)-1])
return None
word = input()
print(Palindrome.is_palindrome(word))
ΣΩΣΤΟ
word = input()
x = ''.join(reversed(word))
if word == x:
print('TRUE')
else:
print('false')
print(''.join(reversed(word)))
SOSTO ME CLASS
class Palindrome:
@staticmethod
def is_palindrome(word):
x = ''.join(reversed(word))
if(x == word):
return True
else:
return False
word = input()
print(Palindrome.is_palindrome(word))