Page 1 :
WHAT IS FUNCTION 2, , Function 1s a code that has a name and it can be, reused(execute again) by specifying its name in the, program, whenever needed., , Functions help break our program into smaller parts.
Page 2 :
FUNCTION, , def display():, print("hello welcome to python programming"), print("you are learning about functions"), , display(), , Output 8, , hello welcome to python programming, you are learning about functions
Page 3 :
following are the advantages of using functions in a program: ™, , > Increases readability, particularly for longer code as by using, functions, the program 1s better organized and easy to understand., , > Reduces code length as same code is not required to be written at, multiple places in a program. This also makes debugging easier., , > Increases reusability, as function can be called from another function, or another program. Thus, we can reuse or build upon already defined, functions and avoid repetitions of writing the same piece of code., , > Work can be easily divided among team members and completed in, parallel.
Page 4 :
TYPES OF FUNCTION, , Built in function: These are predefined function in python and are, always available for use., , For example: int(), type(), print(), input() etc., , Function defined in modules: These are also predefined function, which are part of particular module., , For example: pow(), sqrt., , User defined function: these are the function defined by the, programmer.as we can create our own function ., , For Example: sum()
Page 5 :
CREATING USER DEFINED FUNCTION, , , , , , , , , , , , def<function name> ([parameter 1, parameter 2, .....]): | Function Header <A, set of instruction to be executed Function body Should be indented, return value within the function header, , , , , , , , > The items enclosed in "[ ]" are called parameters and they are optional. Hence, a, function may or may not have parameters. Also, a function may or may not, return a value., , > Function header always ends with a colon (:)., , > Function name should be unique. Rules for naming identifiers also applies for, function naming., , > The statements outside the function indentation are not considered as part of the, function