Commit 0060b06a authored by Fred Drake's avatar Fred Drake

Add a scalar product to the example list comprehensions based on a suggestion

sent to python-docs.
parent dae32cc4
......@@ -1846,6 +1846,8 @@ SyntaxError: invalid syntax
[8, 6, -18, 16, 12, -36, 24, 18, -54]
>>> [x+y for x in vec1 for y in vec2]
[6, 5, -7, 8, 7, -5, 10, 9, -3]
>>> [vec1[i]*vec2[i] for i in range(len(vec1))]
[8, 12, -54]
\end{verbatim}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment