We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c46245 commit 5c360b0Copy full SHA for 5c360b0
python/easy/9. Palindrome Number.py
@@ -1,5 +1,10 @@
1
class Solution:
2
def isPalindrome(self, x: int) -> bool:
3
- str_forward = str(x)
4
- str_backward = str_forward[::-1]
5
- return str_forward == str_backward
+ """
+ isPalindrome returns true or false depending on if x int input is a palindrome number
+ palindrome numbers are the same forward as they are backwards
6
+ x: int (-231 <= x <= 231 - 1)
7
8
+ str_forward = str(x) #convert x int to str
9
+ str_backward = str_forward[::-1] #reverse str
10
+ return str_forward == str_backward #return comparison of forward and backwards str
0 commit comments