Keyword Arguments

Keyword Arguments

Keyword arguments will invoke the function after the parameters are recognized by their parameter names. The value of the keyword argument is matched with the parameter name and so, one can also put arguments in improper order (not in order).

Example:

def printdata (name):
	print (“Example-1 Keyword arguments”)
	print (“Name :”,name)
	return
# Now you can call printdata() function
printdata(name = “Gshan”)

When the above code is executed, it produces the following output :

Output:

Example-1 Keyword arguments

Name :Gshan

Example:

def printdata (name):
	print (“Example-2 Keyword arguments”)
	print (“Name :”, name)
	return
# Now you can call printdata() function
printdata (name1 = “Gshan”)

When the above code is executed, it produces the following result :

TypeError: printdata() got an unexpected keyword argument 'name1'

Example:

def printdata (name, age):
	print ("Example-3 Keyword arguments")
	print ("Name :",name)
	print ("Age :",age)
	return
# Now you can call printdata() function
printdata (age=25, name="Gshan")

When the above code is executed, it produces the following result:

Output:

Example-3 Keyword arguments

Name : Gshan

Age : 25

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad