1.

How can we pass optional or keyword parameters from one function to another in Python ?

Answer»

Gather the arguments using the * and ** specifiers in the function’s parameter list. It gives us positional arguments as a tuple and the keyword arguments as a dictionary. Then we can pass these arguments while calling another function by using

# and ** 

def funl (a, *tup, ** keyword.Arg): 

keyword Argj’width’j = ‘23.3c’ 

fun2 (a, *tup, **keywordArg)



Discussion

No Comment Found