tutorial example

Ruben Charles rubencharles at gmail.com
Sat Nov 12 13:37:05 CET 2005


That is the diference between a method and a function.
A method do something and a function return something.

Example:

def psum(n, m):
    print (n + m)

def rsum(n, m):
    return (n +m)

Then try this...


>>>  psum(2, 3)

>>> a = psum(2, 3)

>>> a

>>> a = rsum(2, 3)

>>> a

You see it?



More information about the Python-list mailing list