Commit 7ec1fac 1 parent c5f923d commit 7ec1fac Copy full SHA for 7ec1fac
File tree 1 file changed +2
-6
lines changed
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -270,9 +270,6 @@ public class Main {
270
270
<PySection>
271
271
272
272
` ` ` py
273
- # import itertools
274
-
275
-
276
273
def psum (a ):
277
274
psum = [0 ]
278
275
for i in a :
@@ -290,9 +287,8 @@ for i in range(Q):
290
287
` ` `
291
288
292
289
An alternative approach is to use [ ` itertools .accumulate ` ](https://docs.python.org/3/library/itertools.html#itertools.accumulate).
293
-
294
- The first value returned is that of the iterable passed, so we add a zero in the front.
295
- Note that in newer versions you can give the optional parameter ` initial = 0 ` .
290
+ Notice that we need to add a $0$ to the front of the array.
291
+ If using a newer version, you can use the optional parameter ` initial = 0 ` as well.
296
292
297
293
` ` ` py
298
294
import itertools
You can’t perform that action at this time.
0 commit comments