write a function to add any number of numbers for Eg. add(1,2) add(1,2,3) add(1,2,3,4,5)
Source code
def add(*args): sum1=0 for arg in args: sum1+=arg return sum1 print("add(1,2) = ",add(1,2)) print("add(1,2,3) = ",add(1,2,3) ) print("add(1,2,3,4,5) = ",add(1,2,3,4,5))
Output
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments