[go: up one dir, main page]

0% found this document useful (0 votes)
31 views1 page

Keyword Arguments

Keyword parameters allow for passing arguments to functions by explicitly naming the parameters, which is useful when the order of parameters is unknown. The syntax for defining a function and calling it with keyword arguments is provided. A syntax error occurs if positional arguments are placed after keyword arguments in a function call.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Keyword Arguments

Keyword parameters allow for passing arguments to functions by explicitly naming the parameters, which is useful when the order of parameters is unknown. The syntax for defining a function and calling it with keyword arguments is provided. A syntax error occurs if positional arguments are placed after keyword arguments in a function call.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

============================================

3) Keyword Parameters (or) arguments


============================================
=>In some of the circumstances, we know the function name and formal parameter
names and we don't know the order of formal Parameter names and to pass the data /
values accurately we must use the concept of Keyword Parameters (or) arguments.
=>The implementation of Keyword Parameters (or) arguments says that all the formal
parameter names used as arguments in Function call(s) as keys.

Syntax for function definition:-


-------------------------------------------------
def functionname(param1,param2...param-n):
---------------------------------------------
---------------------------------------------

-------------------------------------------------
Syntax for function call:-
-------------------------------------------------
functionname(param-n=val-n,param1=val1,param-n-1=val-n-1,.........)

Here param-n=val-n,param1=val1,param-n-1=val-n-1,...... are called Keywords


arguments
=>When we specify Keyword arguments before Possitional Arguments in Function
Calls(s) then we get
SyntaxError: positional argument follows keyword argument bcoz PVM gives First
Priority for positional arguments.
========================================X==========================================
============

You might also like