Skip to content

Commit 9edab3f

Browse files
committed
remove unnecessary list comprehension
1 parent a8ad2d1 commit 9edab3f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: project_euler/problem_01/sol1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def solution(n: int = 1000) -> int:
2121
0
2222
"""
2323

24-
return sum([e for e in range(3, n) if e % 3 == 0 or e % 5 == 0])
24+
return sum(e for e in range(3, n) if e % 3 == 0 or e % 5 == 0)
2525

2626

2727
if __name__ == "__main__":

Diff for: project_euler/problem_01/sol5.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Find the sum of all the multiples of 3 or 5 below N.
66
"""
77

8-
"""A straightforward pythonic solution using list comprehension"""
8+
"""A straightforward pythonic solution using comprehension"""
99

1010

1111
def solution(n: int = 1000) -> int:
@@ -21,7 +21,7 @@ def solution(n: int = 1000) -> int:
2121
83700
2222
"""
2323

24-
return sum([i for i in range(n) if i % 3 == 0 or i % 5 == 0])
24+
return sum(i for i in range(n) if i % 3 == 0 or i % 5 == 0)
2525

2626

2727
if __name__ == "__main__":

0 commit comments

Comments
 (0)