How do I code a python3 summation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I code a python3 summation?

30th Oct 2018, 10:17 PM
Norm
Norm - avatar
3 Answers
+ 3
Norm the first part is good only that you should write it like this: print(sum([1,2,3,4])) If you want to use a lambda I think this might work: from functools import reduce print(int(reduce(lambda x,y: x+y, [1,2,3,4]))) But these are just a few ways of doing it 😆😉
31st Oct 2018, 11:04 PM
Uni
Uni - avatar
+ 2
Try something and we'll see from there.
30th Oct 2018, 11:11 PM
Uni
Uni - avatar
0
thx so much for the help!
9th Mar 2020, 10:36 PM
Norm
Norm - avatar