>>> def add2nums(x, y): ... return x + y ... >>> result = add2nums(1, 1) >>> print result 2 >>> # an example with default arguments ... >>> def sayhi(greeting = "hello, world"): ... print greeting ... >>> sayhi("hello from python!") hello from python! >>> sayhi() hello, world