0

Arbitrary argument*////functions

unable to utilize the arbitrary argument showing tuple and int error https://code.sololearn.com/cD0MiSYYPI27/?ref=app

15th May 2018, 3:48 AM
Kesava N
Kesava N - avatar
4 Answers
0
as input is dynamic if I want to add 4 parameters but give code for 3 parameters we use arbitrary argument! so now u got my question
15th May 2018, 4:48 AM
Kesava N
Kesava N - avatar
0
hi, sorry for that. took an hour. try this. code:- def add(*args): z = 0 for num in args: z += num print(z) add(1,1,1,1) this is compilation online:- https://ide.geeksforgeeks.org/xPghRHo6u6 #python #codding
15th May 2018, 5:10 AM
Rajeeb
0
don't worry I got in the msrg itself a+sum(b)
15th May 2018, 4:52 PM
Kesava N
Kesava N - avatar
- 1
hi, do not put pointers in arguments ( *parameters) , it will not work. correct code:- def add(a, b,c): print('a',a) print('b',b) print('c',c) if b>6: b=0 return (a+b) print (add(6,7,8)) #python #codding
15th May 2018, 4:47 AM
Rajeeb