Learn Python #5
Adding your own function
Creating new functions to solve your particular problems is one of the most useful things about a general-purpose programming language.
In the context of programming, a function is a named sequence of statements that performs a desired operation. This operation is specified in a function definition. The functions we have been using so far have been defined for us, and these definitions have been hidden. This is a good thing, because it allows us to use the functions without worrying about the details of their definitions.
The syntax for a function definition is:
def NAME( LIST OF PARAMETERS ):
STATEMENTS
Comments
Post a Comment