Y
Hacker News
new
|
ask
|
show
|
jobs
by
FreeFull
3653 days ago
I would write it like this, to avoid constructing the immediate list:
sum_of_squares = sum(x*x for x in arr)
This makes use of
https://www.python.org/dev/peps/pep-0289/
1 comments
brianwawok
3653 days ago
Thanks for the link, this is good to know.
link