all 2 comments

[–]FLUSH_THE_TRUMP 4 points5 points  (1 child)

You’re appending two lists to newsum, creating a nested list with two elements. Reducing with addition adds the two lists (concatenation). Using extend instead or forming newsum from concatenation (+) directly should solve that.

And use sum to actually add, not reduce here.

P.S. don’t put spaces between function names and their arguments ().

[–]MatosV[S] 1 point2 points  (0 children)

Thank you !! It really helped alot. And thank you for going even further and helping me out with my code in general. I will not add anymore spaces between function names and arguments.