8000 Merge pull request #121 from ragumagu/patch-1 · rougier/from-python-to-numpy@7272273 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7272273

Browse files
authored
Merge pull request #121 from ragumagu/patch-1
Update 02-introduction.rst for issue #119
2 parents 00a7951 + ddbd18e commit 7272273

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

02-introduction.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ super simple. We just have to translate itertools call into NumPy ones.
128128
def random_walk_fastest(n=1000):
129129
# No 's' in NumPy choice (Python offers choice & choices)
130130
steps = np.random.choice([-1,+1], n)
131-
return np.cumsum(steps)
131+
steps = np.cumsum(steps)
132+
return [0] + steps.tolist()
132133
133134
walk = random_walk_fastest(1000)
134135

0 commit comments

Comments
 (0)
0