Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
13 views

functions in python

function in pythonclass 12

Uploaded by

preeti.dalal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

functions in python

function in pythonclass 12

Uploaded by

preeti.dalal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

FUNCTIONS IN PYTHON

FUNCTIONS

 Function is a collection of statements which is made to perform a


specific task.
 Instead of writing a large program, we can write small functions as a
specific part of program to accomplish the task.
 To execute function, we have to call it in a program
 Once written, a function can also be used in other programs as library
functions.
Types of Functions

 Built –in functions


 Functions defined in module
 User defined functions
Built in functions

 These are pre-defined functions and are always available for use
 In order to use these functions, there is no need to import any
module
 We can directly use it, in our program.
 Examples: len(), print(), int(), input(), type(), id()
Functions defined in Modules

 These functions are pre-defined in particular modules.


 These can only be used when the corresponding module is imported.
 Examples: math module- sin(), cos(), sqrt(), fabs(), ceil(), floor()
 Statistics module- mean(), median(), mode()
 Random module()- random(), choice(), randint()
User-defined Functions

 These functions are defined by the programmer.


 Functions that we define ourselves to do certain specific task are
referred as user-defined functions.
 Syn

You might also like