Lecture 4 Functions
Lecture 4 Functions
Lecture 4 : Functions
Lecture Contents
• Introduction
• Python Syntax to define and call functions
• Void and value returning functions
• Flow of execution
• Variable scope , local and global variables
• Arguments and parameters
• Types of arguments
• Return statement
• Recursion
• Lambda functions
• Void functions
• Function which do not return a value
• Just execute the statements it contains and terminates
• Value Returning Function
• Executes the statements it contains and returns a value back to the statement/program
which called it.
• When you call the input function, it gets the data that the user types on the keyboard and returns
that data as a string.
• The int and float functions are also examples of value-returning functions.
• You pass an argument to the int function, and it returns that argument’s value converted to an integer
• Example