+ 2

Could you plz let me know any other way of writing a code which sum all numbers in a list?

https://code.sololearn.com/cBcTk0Iha13q/?ref=app

4th Oct 2017, 1:58 PM
Shabnam
Shabnam - avatar
4 odpowiedzi
+ 5
#use reduce function def arg0001(a,b): return a+b def sum_args(*args): return reduce(arg0001,args) print(sum_args(2,3,4)) #Finding better one? ah I'm not sure that urs or mine which is better. well I currently read manga >w<
4th Oct 2017, 2:45 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
4th Oct 2017, 2:20 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 2
Dear @hard thank you so much for the code. Can I ask you which how I can find which code is the best of writing a code? for example my code is different than urs. how one can find a code better?
4th Oct 2017, 2:40 PM
Shabnam
Shabnam - avatar
+ 2
thank you very much @hard
4th Oct 2017, 2:48 PM
Shabnam
Shabnam - avatar