+ 2
Could you plz let me know any other way of writing a code which sum all numbers in a list?
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<
+ 4
brooo um
Use varargs
https://code.sololearn.com/cr0d8qoC4qW5/?ref=app
+ 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?
+ 2
thank you very much @hard