Home Research Creating a Basic Function in Python

Continued adventures in learning Python (started here):

A function gives you a return value based on an argument that you input.  The function len will give you a return value of the number of elements in an object.  The argument you provide is the name of the object.  In this example the object is called “names.”

Screen Shot 2014-05-31 at 10.30.34 AM

You create a function by using the syntax def (define).  This function is called “Mary” (it could be called anything).  The function doubles the argument.

Screen Shot 2014-05-31 at 10.28.44 AM

Leave a Reply