A function is a block of code which performs a computation. They can be reused in a program.
Here are some functions that can be used on lists
https://docs.python.org/2/tutorial/datastructures.html
These are inbuilt functions. Certain functions like maths functions can be imported into the program by typing
from math import*
We can also create our own functions. The 'Hello World' program can be written in a function as shown below.
def hello():
print "Hello World"
To call and run the function type hello() in the python shell
No comments:
Post a Comment