Keyword Arguments Demo : Function Keyword Arguments : Function : Python examples (example source code) Organized by topic

C++
PHP
Python
Python Home »  Function   » [  Function Keyword Arguments  ]  Screenshots 
 



Keyword Arguments Demo






# Functions can also be called using keyword arguments of the form 
"keyword = value".

def parrot(voltage, state='state', action='action', type='type'):
    print "-- Action:", action,
    print "Vol", voltage 
    print "-- type:", type
    print "-- state", state


parrot(1000)
parrot(action = 'A', voltage = 1000000)
parrot('A', state = 'B')
parrot('A''B''C')


           
       
Related examples in the same category
1.  Keyword arguments example. Keyword arguments example.
2.  Keyword Parameters and Defaults Keyword Parameters and Defaults
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.