how to add two numbers in kwargs function code example
Example 1: use of kwargs and args in python classes
def myFun(*args,**kwargs):
print("args: ", args)
print("kwargs: ", kwargs)
myFun('my','name','is Maheep',firstname="Maheep",lastname="Chaudhary")
# *args - take the any number of argument as values from the user
# **kwargs - take any number of arguments as key as keywords with
# value associated with them
Example 2: python *args to dict
def func(arg1, arg2, arg3=3, arg4=4):
print(locals())
func(1, 2)
# {'arg3': 3, 'arg4': 4, 'arg1': 1, 'arg2': 2}