How can we pass optional or keyword parameters from one function to another in Python?
Answer / chaitanya
Gather the arguments using the * and ** specifiers in the function's parameter list. This 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 fun1(a, *tup, **keywordArg):
...
keywordArg['width']='23.3c'
...
Fun2(a, *tup, **keywordArg)
Is This Answer Correct ? | 0 Yes | 0 No |
What is __init__.py used for?
Explain about repr function?
1) How to validate ip address using regex 2)program to increment ip address in python Please find answers to above questions thanks in advance.
What packages in the standard library, useful for data science work, do you know?
How do you add in python?
Explain about dir() and help() function will do in python?
What are the runtime errors?
What does exit () do in python?
Why does it say none in python?
Which is better PHP or Python?
What are the differences in the deep and shallow copy?
Mention the floor division available in python