Programming Pandit

c/c++/c#/Javav/Python


Latest Update

Monday, November 23, 2020

Python program to display the concept of default argument, Keyword Arguments by G Krishna Chauhan

Source Code

Default Argument 


def wish(name="G Krishna"):

    print("Hello", name,"Happy New Year")


wish()

wish("Mr. Chauhan")


OUTPUT:

Hello G Krishna Happy New Year

Hello Mr. Chauhan Happy New Year


Keyword Argument


def wish(name,msg):

    print("Hello", name,msg)


wish("Good Morning","madan")

wish(name="RAM",msg="Good Morning")

wish(msg="Good Morning",name="Madan")


OUTPUT:

Hello Good Morning madan

Hello RAM Good Morning

Hello Madan Good Morning




No comments:

Post a Comment