Browse Source

Update palindrome-alternative.py

PythonCoder8 4 years ago
parent
commit
062f2c252b
1 changed files with 5 additions and 5 deletions
  1. 5 5
      palindrome-alternative.py

+ 5 - 5
palindrome-alternative.py

@@ -1,8 +1,8 @@
 text = input('Enter any text or number: ')
 text = input('Enter any text or number: ')
 class Solution(object):   
 class Solution(object):   
-    def isPalindrome(self,x):
-        if str(x)[::-1] == str(x):
-            return f'The text "{str(x)}"is a palindrome.'
+    def isPalindrome(self, phrase:str) -> str:
+        if str(phrase)[::-1] == str(phrase):
+            return f'The text "{str(phrase)}"is a palindrome.'
         else:
         else:
-            return f'The text "{str(x)}" is not a palindrome.'
-print(Solution().isPalindrome(text))
+            return f'The text "{str(phrase)}" is not a palindrome.'
+print(Solution().isPalindrome(text))