Skip to content

Commit c7c9eef

Browse files
committed
Fixes for issue 'Fix the LGTM issues #1024'.
1 parent cf3df56 commit c7c9eef

File tree

8 files changed

+7
-9
lines changed

8 files changed

+7
-9
lines changed

project_euler/problem_02/sol4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212
from __future__ import print_function
1313
import math
14-
from decimal import *
14+
from decimal import Decimal, getcontext
1515

1616
try:
1717
raw_input # Python 2

project_euler/problem_03/sol1.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,22 @@ def isprime(no):
2828

2929
def solution(n):
3030
"""Returns the largest prime factor of a given number n.
31-
31+
3232
>>> solution(13195)
3333
29
3434
>>> solution(10)
3535
5
3636
>>> solution(17)
3737
17
38+
>>> solution(0)
39+
-1
3840
"""
3941
maxNumber = 0
4042
if isprime(n):
4143
return n
4244
else:
45+
if n <= 0:
46+
return -1
4347
while n % 2 == 0:
4448
n = n / 2
4549
if isprime(n):
@@ -54,7 +58,6 @@ def solution(n):
5458
elif isprime(i):
5559
maxNumber = i
5660
return maxNumber
57-
return int(sum)
5861

5962

6063
if __name__ == "__main__":

project_euler/problem_03/sol2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
e.g. for 10, largest prime factor = 5. For 17, largest prime factor = 17.
77
"""
88
from __future__ import print_function, division
9-
import math
109

1110
try:
1211
raw_input # Python 2

project_euler/problem_05/sol1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def solution(n):
3939
if i == 0:
4040
i = 1
4141
return i
42-
break
4342

4443

4544
if __name__ == "__main__":

project_euler/problem_07/sol2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
We can see that the 6th prime is 13. What is the Nth prime number?
88
"""
99
from __future__ import print_function
10-
from math import sqrt
1110

1211
try:
1312
raw_input # Python 2

project_euler/problem_09/sol1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def solution():
2828
if (a ** 2) + (b ** 2) == (c ** 2):
2929
if (a + b + c) == 1000:
3030
return a * b * c
31-
break
3231

3332

3433
if __name__ == "__main__":

project_euler/problem_19/sol1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ def solution():
6161

6262

6363
if __name__ == "__main__":
64-
print(solution(171))
64+
print(solution())

project_euler/problem_234/sol1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def solution(n):
4040
semidivisible = []
4141
for x in range(n):
4242
l=[i for i in input().split()]
43-
c1=0
4443
c2=1
4544
while(1):
4645
if len(fib(l[0],l[1],c2))<int(l[2]):

0 commit comments

Comments
 (0)