IGCSE Class 10  >  Class 10 Notes  >  Mathematics for GCSE/  >  Short Notes: Functions

Short Notes: Functions

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


 
   
Working With Function 
 
Function: - A function is a subprogram that act on data and 
often return a value. 
 
Python function types:- 
 
1 = Built in function: - These are pre-define function and 
always available for use. You have used some of them like - 
len (), type (), int (), input () etc. 
 
2 = Function defined in modules: - These functions are pre-
defined in particular models and can only be used when the 
corresponding model is imported. 
For example: - If we want to find the square root of any 
number then we have import math module then call the 
function - sqrt () 
 
3 = User defined functions: - These are define by the 
programmer. As programmer you can create your own 
function. 
 
 
Defining function in python:-  
Page 2


 
   
Working With Function 
 
Function: - A function is a subprogram that act on data and 
often return a value. 
 
Python function types:- 
 
1 = Built in function: - These are pre-define function and 
always available for use. You have used some of them like - 
len (), type (), int (), input () etc. 
 
2 = Function defined in modules: - These functions are pre-
defined in particular models and can only be used when the 
corresponding model is imported. 
For example: - If we want to find the square root of any 
number then we have import math module then call the 
function - sqrt () 
 
3 = User defined functions: - These are define by the 
programmer. As programmer you can create your own 
function. 
 
 
Defining function in python:-  
 
   
Look figure carefully -- 
 
 
 
 
Function header: - The first line of the function definition 
that beings with keyword Def and ends with a colon (:), 
specifies the name of the function and its parameters. 
 
Parameters: - Variables that are listed within the 
parentheses of a function header. 
Page 3


 
   
Working With Function 
 
Function: - A function is a subprogram that act on data and 
often return a value. 
 
Python function types:- 
 
1 = Built in function: - These are pre-define function and 
always available for use. You have used some of them like - 
len (), type (), int (), input () etc. 
 
2 = Function defined in modules: - These functions are pre-
defined in particular models and can only be used when the 
corresponding model is imported. 
For example: - If we want to find the square root of any 
number then we have import math module then call the 
function - sqrt () 
 
3 = User defined functions: - These are define by the 
programmer. As programmer you can create your own 
function. 
 
 
Defining function in python:-  
 
   
Look figure carefully -- 
 
 
 
 
Function header: - The first line of the function definition 
that beings with keyword Def and ends with a colon (:), 
specifies the name of the function and its parameters. 
 
Parameters: - Variables that are listed within the 
parentheses of a function header. 
 
   
 
Function body: - The block of statement/indented - 
statement beneath function header that defines the action 
performed by the function.  
 
Indentation: - The blank space in the beginning of statement 
within a block. All statements within same block have same 
indentation. 
 
Flow of execution: - The flow of execution refers to the order 
in which statement are executed during a program run. 
 
For example: -  
def calcSum (x,y): 
        s = x + y 
        return s 
num1 = float (input ("Enter the first number: ")) 
num2 = float (input("Enter the second number : ")) 
sum = calSum (num1,num2) 
Page 4


 
   
Working With Function 
 
Function: - A function is a subprogram that act on data and 
often return a value. 
 
Python function types:- 
 
1 = Built in function: - These are pre-define function and 
always available for use. You have used some of them like - 
len (), type (), int (), input () etc. 
 
2 = Function defined in modules: - These functions are pre-
defined in particular models and can only be used when the 
corresponding model is imported. 
For example: - If we want to find the square root of any 
number then we have import math module then call the 
function - sqrt () 
 
3 = User defined functions: - These are define by the 
programmer. As programmer you can create your own 
function. 
 
 
Defining function in python:-  
 
   
Look figure carefully -- 
 
 
 
 
Function header: - The first line of the function definition 
that beings with keyword Def and ends with a colon (:), 
specifies the name of the function and its parameters. 
 
Parameters: - Variables that are listed within the 
parentheses of a function header. 
 
   
 
Function body: - The block of statement/indented - 
statement beneath function header that defines the action 
performed by the function.  
 
Indentation: - The blank space in the beginning of statement 
within a block. All statements within same block have same 
indentation. 
 
Flow of execution: - The flow of execution refers to the order 
in which statement are executed during a program run. 
 
For example: -  
def calcSum (x,y): 
        s = x + y 
        return s 
num1 = float (input ("Enter the first number: ")) 
num2 = float (input("Enter the second number : ")) 
sum = calSum (num1,num2) 
 
   
print("Sum of two given number is ",sum) 
 
 
 
Argument: - The values being passed through a function call 
statement are called argument (or actual parameters or 
actual argument). 
For example:-  
def calcSum ( x , y ): 
        s = x + y 
        return s 
 
print (calcSum ( 2 , 3 )) 
a = 5 
b = 6  
print (calcSum ( a , b )) 
d = 10 
print (calcSum ( 9 , d )) 
? Here a , b , d , 2 , 3 , 9 are “arguments” which is used in 
call function. 
 
Page 5


 
   
Working With Function 
 
Function: - A function is a subprogram that act on data and 
often return a value. 
 
Python function types:- 
 
1 = Built in function: - These are pre-define function and 
always available for use. You have used some of them like - 
len (), type (), int (), input () etc. 
 
2 = Function defined in modules: - These functions are pre-
defined in particular models and can only be used when the 
corresponding model is imported. 
For example: - If we want to find the square root of any 
number then we have import math module then call the 
function - sqrt () 
 
3 = User defined functions: - These are define by the 
programmer. As programmer you can create your own 
function. 
 
 
Defining function in python:-  
 
   
Look figure carefully -- 
 
 
 
 
Function header: - The first line of the function definition 
that beings with keyword Def and ends with a colon (:), 
specifies the name of the function and its parameters. 
 
Parameters: - Variables that are listed within the 
parentheses of a function header. 
 
   
 
Function body: - The block of statement/indented - 
statement beneath function header that defines the action 
performed by the function.  
 
Indentation: - The blank space in the beginning of statement 
within a block. All statements within same block have same 
indentation. 
 
Flow of execution: - The flow of execution refers to the order 
in which statement are executed during a program run. 
 
For example: -  
def calcSum (x,y): 
        s = x + y 
        return s 
num1 = float (input ("Enter the first number: ")) 
num2 = float (input("Enter the second number : ")) 
sum = calSum (num1,num2) 
 
   
print("Sum of two given number is ",sum) 
 
 
 
Argument: - The values being passed through a function call 
statement are called argument (or actual parameters or 
actual argument). 
For example:-  
def calcSum ( x , y ): 
        s = x + y 
        return s 
 
print (calcSum ( 2 , 3 )) 
a = 5 
b = 6  
print (calcSum ( a , b )) 
d = 10 
print (calcSum ( 9 , d )) 
? Here a , b , d , 2 , 3 , 9 are “arguments” which is used in 
call function. 
 
 
   
Parameters: - The values received in the function definition 
header are called parameter (or formal parameters or formal 
arguments). 
For example: - 
def calcSum ( x , y ): 
        : 
? Here x , y are “parameters”  
 
Passing parameters:-  
 
Python support three types of formal arguments/parameters: 
 
1:- Positional argument (required arguments): - When the 
functions call statement must match the number and order 
of arguments as define in the functions definition this is 
called the position argument matching. 
For example:-  
def check (a,b,c): 
       : 
Then possible functions call for this can be:- 
 
check ( x , y , z ) # 3 values( all variables) passed  
 
Read More
Explore Courses for Class 10 exam
Related Searches
Exam, Extra Questions, Previous Year Questions with Solutions, Objective type Questions, past year papers, video lectures, practice quizzes, Important questions, Viva Questions, Free, Semester Notes, mock tests for examination, shortcuts and tricks, Short Notes: Functions, MCQs, Short Notes: Functions, ppt, Sample Paper, study material, Summary, pdf , Short Notes: Functions;