28th Apr 2020, 7:48 AM
Neeraj Agarwal
Neeraj Agarwal - avatar
3 Respostas
+ 2
# if you want to use this signature: def nestEggVariable(salary,save,*growthRates): # ... and you want to pass many growthRathes as list or tuple, you need to call it this way: nestEggVariable(1000,5,*g) # alernatively, if you call it this way: nestEggVariable(1000,5,g) # ... you need this function signature: def nestEggVariable(salary,save,*growthRates): # more generaly: def func(*args): # ... expect to be called this way: func(arg1,arg2,arg3) # (with any number of arguments) # if you have a list or tuple of arguments: call_arg = (arg1,arg2,arg3) # ... and you do: func(call_arg) # insteat of func(*call_arg) # your function will receive the tuple as first argument ^^ Neeraj Agarwal check this link: https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-kwargs-and-args/
28th Apr 2020, 9:09 AM
visph
visph - avatar
+ 1
Post language name in tags where you have written beginner Also try printing i and growthRate after for Loop and you will see the problem Here is the solution https://www.geeksforgeeks.org/packing-and-unpacking-arguments-in-JUMP_LINK__&&__python__&&__JUMP_LINK/amp/
28th Apr 2020, 9:12 AM
Abhay
Abhay - avatar
+ 1
Thanks Guys
28th Apr 2020, 10:05 AM
Neeraj Agarwal
Neeraj Agarwal - avatar