Write a program to illustrate ""Keyword arguments"".
Answers
Answered by
0
void add(in, ion will not compile as well. You must provide default values for each argument after b . In this case, c and d should also be assigned default values.
Answered by
0
Keyword arguments are the functions with many defined parameters. They have a certain name and values attached to it.
- An example of keyword arguments includes -
#!/usr/bin/python
# Filename: func_key.py
def func(a, b= 6, c=10):
print 'a is', a, 'and b is', b, 'and c is', c
func( 4, 7)
func(22, c=24)
func(c=40, a=100)
- Output -
$ python func_key.py
a is 4 and b is 7 and c is 10
a is 22 and b is 6 and c is 24
a is 100 and b is 6 and c is 40
Similar questions
Science,
4 months ago
Physics,
4 months ago
Computer Science,
9 months ago
Computer Science,
9 months ago
Math,
1 year ago
Chemistry,
1 year ago