Hacker News new | past | comments | ask | show | jobs | submit login
My simplicity toolkit: Programming (part 2) (jensrantil.github.io)
4 points by JensRantil on Nov 14, 2023 | hide | past | favorite | 2 comments



> reduce(lambda acc, value: acc * (value ** 2), numbers, 0)

It is also wrong as that expression is always 0.

Going by the function name, the * should be a +.

If you wanted the product of squares, instead replace the 0 with 1.


Nice catch! Fixed!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: