There are no items in your cart
Add More
Add More
Item Details | Price |
---|
Tue Apr 18, 2023
Types of Function:
Built -in functions are the predefined functions that are already available in Python.
For Example:
input(), print(), int(), float(), eval(), max() and min()
abs(), type(), len(), round(), range()
2. Functions in Module
When a program become more lengthy and complex, there arises a need for the tasks to be spilt into smaller segments called modules.
When we break a program into modules, each module should contain functions that perform related tasks.
A module in Python is a file that contains a collection of related functions.
Functions of math module:
ceil(), floor(), pow(), sqrt(), fabs(), cos(), sin(), tan()
Functions of random module:
randrange(), randint(), random()
3. User - defined functions
A user defined function is created or defined by the def keyword, followed by the function name, parentheses () and colon (:)
Syntax of Python Function
def function_name (optional parameters ):
Code of function
function_name(optional parameters values)
The first line of function definition i.e. def function_name (optional parameters ): is called function header.
function_name (optional parameters values) statement is called function calling statement
For Example:
S P SHARMA CLASSES