FUNCTIONS
WHAT IS A FUNCTION?
 Functions
 Well Defined Single Tasks
 Creates easier to read code
 Segments an application to manage easier
 Creates reusable code segments
 Named using camelCase
 Provide proper names like variables
 The function name should specify what the function is intended to do.
 The list of instructions should accomplish what its name implies.
FUNCTION DEFINITION
Definition includes:
 name: name of the function. Function names follow
same rules as variables
 body: statements that perform
the function’s task
 return value: the value the function returns to the part of
the program that called it
 parameter list: variables containing
values passed to the function
DECLARING FUNCTION
Each function should perform only a single task
 Code:
 Declaring a Basic Function:
 def functionName ():
Function Body
 Common Errors: function names are case sensitive,
Trying to return a value with no return statement
CALLING A FUNCTION
 Functions just like variables need to be called in order
to be invoked
 Code:
 Calling a Function:
 functionName ()
o Ex.
main()
blink()
WRITE AND CALLING FUNCTIONS EXAMPLE