KEMBAR78
Python Introduction | JNTUA | R19 | UNIT 1 | Functions | PPTX
Python Programming
By
Mr. Raja Bhargava
Assistant professor
Computer science and Engineering
Visvodaya Technical Academy, Kavali
UNIT-I
Lecture 7
Functions (Part 2)
1. Math functions
2. Composition
3. Adding new functions
4. Flow of execution
Module
Set of
functions
Math Module
Set of
mathematical
functions
What is math module?
Before we can use the module, we must
import it as mentioned below:
Import math
This statement creates a module named
math.
What is math module?
To access one of the functions in the
module, you must specify the name of
the module and the name of the function,
separated by a dot.
math.sqrt(4)
What is math module?
Examples
Composition
Adding new functions
Function:
Statement 1
Statement 2
Statement 3
Statement 4
….
….
Program:
Statement 1
Statement 2
Call function
Statement 3
Call function
….
….
Executed
Flow of execution (one function)
Function1:
Statement 1
Statement 2
Call function2
Statement 3
….
….
Program:
Statement 1
Statement 2
Call function1
Statement 3
Statement 4
….
….
Executed
Function2:
Statement 1
Statement 2
Statement 3
Statement 4
….
….
Executed
Flow of execution (Two functions)

Python Introduction | JNTUA | R19 | UNIT 1 | Functions