ADVERTISEMENT
ADVERTISEMENT

Python program to call a function using keyword argument

Here, we will write a Python program to call a function using keyword argument which allows us to change the order of arguments.
Submitted by Shivang Yadav, on March 20, 2021

Function in python is a block of code which does a specific operation and can be called from anywhere in the code. Also, function accepts values i.e. argument to work upto.

Python also supports keyword Argument. This allows the programmer to change position on passing arguments. This is done using keyword argument.

Program to call a function using keyword augment

def show(id="<no id>",name="<no name>"):
    print("Your id is :",id,"and your name is :",name)

show(12,"deepak")
show(name = "priya",id = 34)

Output:

Your id is : 12 and your name is : deepak
Your id is : 34 and your name is : priya

Python Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.