0% found this document useful (0 votes)
46 views

Python

This document provides an overview of key Python programming concepts including importing modules, return values from functions, incremental development, and function composition. It discusses how to import functions from other modules, return multiple values from a function, develop code incrementally by writing pseudocode and validating small pieces, and call one function from within another. Examples are given for each concept to demonstrate Python syntax.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Python

This document provides an overview of key Python programming concepts including importing modules, return values from functions, incremental development, and function composition. It discusses how to import functions from other modules, return multiple values from a function, develop code incrementally by writing pseudocode and validating small pieces, and call one function from within another. Examples are given for each concept to demonstrate Python syntax.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Python Programming

Prerna S. Mhatre

ALLPPT.com _ Free PowerPoint Templates, Diagrams and Charts


Importing with from
Python modules can get access to code from another module by importing the functio
n using import.
We can use function in modules in three different ways.
o Import a module object in python .
o Import an object from a module in python.
o Import all object from a module in python.
Return Values

To let a function return a value , use the return. Python achieved with the return statem
ent.
Python also has the ability to return multiple values from a function call.
Example:-
def my_function(x):
return 5*x
print(my_function(3))
Output:
15
Incremental Development

If the code is bigger, then we have to spend the maximum time to debug it. To simplify
this task of dealing with large code we can use a new development process called incre
mental development.
Development step:
1. Write pseudocode line by line on how logic works
2. Write code line by line in python
3. Run program and validate code works with dummy data
4. Repeat steps 2-3 until your function works as anticipated.
Composition

Composition is the ability of calling one function from within another.


Example:-
#function1
def add(x):
return x+2
#function2
def multiply(x):
return x*2
Print(“Adding 2 to 5 and multiplying the result with 2:”,multiplying(add(5)))
Output:
Adding 2 to 5 and multiplying the result with 2:14
Thanks!!
Any Questions….
You can find me at:
prerna6080@gmail.com

You might also like