Keyword Parameters and Defaults : Function Keyword Arguments « Function « Python






Keyword Parameters and Defaults

Keyword Parameters and Defaults
def hello_1(greeting, name):
    print '%s, %s!' % (greeting, name)

def hello_2(name, greeting):
    print '%s, %s!' % (name, greeting)


hello_1('Hello', 'world')
hello_2('Hello', 'world')


hello_1(greeting='Hello', name='world')


hello_1(name='world', greeting='Hello')


hello_2(greeting='Hello', name='world')



           
       








Related examples in the same category

1.Keyword arguments example.Keyword arguments example.
2.Keyword Arguments DemoKeyword Arguments Demo