Skip to content

Commit bd0d031

Browse files
authored
Update Solution.py
1 parent 6295f63 commit bd0d031

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

solution/009.Palindrome Number/Solution.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ def isPalindrome(self, num):
44
:type num: int
55
:rtype: bool
66
"""
7-
if(num<0): return False
7+
if num < 0:
8+
return False
89

9-
temp = num
10-
rev = 0
11-
while(temp>0):
12-
rev = (rev*10)+(temp%10)
13-
temp//=10
14-
15-
return (rev == num)
10+
return str(num) == str(num)[::-1]

0 commit comments

Comments
 (0)