Skip to content

Commit ee51eff

Browse files
committed
P4, P36, P55, P112, P125: Added spaces to slice notation in Python solutions.
1 parent 47d123f commit ee51eff

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

python/p004.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def compute():
1414
for j in range(100, 1000):
1515
k = i * j
1616
s = str(k)
17-
if s == s[::-1] and k > ans:
17+
if s == s[ : : -1] and k > ans:
1818
ans = k
1919
return str(ans)
2020

python/p036.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def compute():
1818

1919
def is_decimal_binary_palindrome(n):
2020
s = str(n)
21-
if s != s[::-1]:
21+
if s != s[ : : -1]:
2222
return False
2323
t = bin(n)[2 : ]
24-
return t == t[::-1]
24+
return t == t[ : : -1]
2525

2626

2727
if __name__ == "__main__":

python/p055.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def compute():
1414

1515
def is_lychrel(n):
1616
for i in range(50):
17-
n += int(str(n)[::-1])
18-
if str(n) == str(n)[::-1]:
17+
n += int(str(n)[ : : -1])
18+
if str(n) == str(n)[ : : -1]:
1919
return False
2020
return True
2121

python/p112.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def compute():
1414
for i in itertools.count(1):
1515
s = str(i)
1616
t = "".join(sorted(s))
17-
if s != t and s[::-1] != t:
17+
if s != t and s[ : : -1] != t:
1818
count += 1 # i is bouncy
1919
if count * 100 == 99 * i:
2020
return str(i)

python/p125.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def compute():
1818
if sigma >= 100000000:
1919
break
2020
s = str(sigma)
21-
if s == s[::-1]: # Is palindrome
21+
if s == s[ : : -1]: # Is palindrome
2222
nums.add(sigma)
2323
return str(sum(nums))
2424

0 commit comments

Comments
 (0)