Today we will learn on this article keyword arguments in Keithon function call. Keyword arguments are related to function calls. When you use keyword arguments in a function call, the caller identifies the arguments by parameter name.
This allows you to skip arguments or make them out of order because the Python interpreter is able to use the provided keywords to match values with parameters. You can call the keyword on the printMe () function as follows –
#!/usr/bin/python # Function definition is here def printfun( str ): "This prints a passed string into this function" print str return; # Now you can call printfunfunction printfun( str = "My string")
Output
My string
Example 2
#!/usr/bin/python # Function definition is here def printd( name, age ): "This prints a passed info into this function" print "Name: ", name print "Age ", age return; # Now you can call printdfunction printd( age=50, name="sandy" )
Result
Name: sandy Age 50