Skip to content

Commit 09a4e89

Browse files
author
Sourcery AI
committed
'Refactored by Sourcery'
1 parent ce82fed commit 09a4e89

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

array.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ def list_compare1(A,B):
1010
Comment:
1111
Still faster than: return all(A[n] == B[n] for n in range(0, len(A)))
1212
"""
13-
for n in range(0,len(A)):
14-
if A[n] != B[n]:
15-
return False
16-
return True
13+
return all(A[n] == B[n] for n in range(0, len(A)))
1714

1815

1916
def list_compare2(A,B):
@@ -28,8 +25,7 @@ def list_compare2(A,B):
2825

2926
def fixed_sliding_window(arr, k):
3027
result = [sum(arr[:k])]
31-
for i in range(0, len(arr)-k):
32-
result.append(result[i] + arr[i+k] - arr[i])
28+
result.extend(result[i] + arr[i+k] - arr[i] for i in range(0, len(arr)-k))
3329
return result
3430
print(fixed_sliding_window(list(range(1,7)),3))
3531

0 commit comments

Comments
 (0)