Posts

Showing posts with the label Function Arguments

Python3 Function Arguments

Python Function Arguments 1 . Function Arguments :        def greet(name, msg):              print("Hello {0}, {1} ".format(name, msg))        #call a function with arguments        greet("Satish", "good morning") output: Hello Satish, good morning         #suppose if we pass one argument        greet("satish") output:   ----------------------------------------------------------------------               ---               TypeError               TypeError : greet( ) missing 1 required positional argument: 'msg' Different Forms of Arguments :        def greet(name, msg="good morning"):              print("Hello {0} , {1}".format(name, msg))            greet("Satish", "good night") output :   Hello Satish , good night         #with out msg argument        greet("Satish")   output:   Hello Satish , good morning   Once we have a default argument , all the arguments to its right must also have