SlideShare a Scribd company logo
Functions
Module 3 Functions, Tuples, Dictionaries,
Data processing
Module 3 Functions
Why do we need functions?
• to appear in more than one place
the first condition
• if a piece of code becomes so large
the second condition
• the product to be implemented as a set of separately
the third condition Decomposition
Module 3 Functions
Where do the functions come from?
built-in functions
pre installed modules
directly from your code
Module 3 Functions
Your first function
print("Enter a value: ")
a = int(input())
print("Enter a value: ")
b = int(input())
print("Enter a value: ")
c = int(input())
change the
message
"Please"
def function_name():
function_body
def message():
print("Enter a value: ")
Module 3 Functions
How functions work 1
def message():
print("Enter a value: ")
print("We start here.")
message()
print("We end here.")
print("We start here.")
message()
print("We end here.")
def message():
print("Enter a value: ")
Module 3 Functions
How functions work 2
def message():
print("Enter a value: ")
message = 1
def message():
print("Enter a value: ")
message()
a = int(input())
message()
b = int(input())
message()
c = int(input())
Module 3 Functions
Key takeaways
• is a block of code
Function
•built-in functions
•pre-installed modules
•user-defined functions
•lambda
4 basic types
•def your_function(optional parameters):
def

More Related Content

What's hot (20)

PDF
Python review2
vibrantuser
 
PPTX
Python for Data Science
Panimalar Engineering College
 
PPTX
Introduction to python programming 1
Giovanni Della Lunga
 
PPT
Python review2
vibrantuser
 
PPT
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
sachin kumar
 
PDF
[PyCon2016]To mock or not to mock, that is the questions
Ana Balica
 
PDF
Lab12 dsa bsee20075
MuhammadUmerShakir
 
PDF
pyton Notes9
Amba Research
 
DOC
Vb file
Mukund Trivedi
 
PPTX
Giving Clarity to LINQ Queries by Extending Expressions R2
Ed Charbeneau
 
PPTX
Python for Beginners(v3)
Panimalar Engineering College
 
PPTX
Chap1 array
raksharao
 
DOC
Ora faq
vishpoola
 
PDF
Erlang assembly
rstudnicki
 
PPT
Oop lecture7
Shahriar Robbani
 
PPTX
Dialog box in vb6
Saroj Patel
 
PDF
Python-02| Input, Output & Import
Mohd Sajjad
 
PPTX
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
PPTX
Learn Function The Hard Way
Iftekhar Mohammad
 
DOCX
Coding java.txt
Putera Sumatera
 
Python review2
vibrantuser
 
Python for Data Science
Panimalar Engineering College
 
Introduction to python programming 1
Giovanni Della Lunga
 
Python review2
vibrantuser
 
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
sachin kumar
 
[PyCon2016]To mock or not to mock, that is the questions
Ana Balica
 
Lab12 dsa bsee20075
MuhammadUmerShakir
 
pyton Notes9
Amba Research
 
Giving Clarity to LINQ Queries by Extending Expressions R2
Ed Charbeneau
 
Python for Beginners(v3)
Panimalar Engineering College
 
Chap1 array
raksharao
 
Ora faq
vishpoola
 
Erlang assembly
rstudnicki
 
Oop lecture7
Shahriar Robbani
 
Dialog box in vb6
Saroj Patel
 
Python-02| Input, Output & Import
Mohd Sajjad
 
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
Learn Function The Hard Way
Iftekhar Mohammad
 
Coding java.txt
Putera Sumatera
 

Similar to Python PCEP Functions (20)

PPTX
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
Maulik Borsaniya
 
PPTX
Lecture 08.pptx
Mohammad Hassan
 
PPTX
Python Lecture 4
Inzamam Baig
 
PPTX
Python functions PYTHON FUNCTIONS1234567
AnjaneyuluKunchala1
 
PDF
DS-lect3.data structure in c ++ engineering
abdopro512
 
PPTX
1P13 Python Review Session Covering various Topics
hussainmuhd1119
 
PPTX
9 functions.pptxFunction that are used in
divyamth2019
 
PDF
Functions
Michael Gordon
 
PDF
Vb.net ii
argusacademy
 
PPTX
Chapter 1 (2) array and structure r.pptx
abenezertekalign118
 
PDF
Unit 1-Part-5-Functions and Set Operations.pdf
Harsha Patil
 
PPTX
Python_Unit-1_PPT_Data Types.pptx
SahajShrimal1
 
PPTX
Mastering Python lesson 4_functions_parameters_arguments
Ruth Marvin
 
PPTX
PPT_1_9102501a-a7a1-493e-818f-cf699918bbf6.pptx
myatminsoe180
 
PDF
The Ring programming language version 1.3 book - Part 83 of 88
Mahmoud Samir Fayed
 
PPTX
Types of Handling functions in Python with an example
SubashiniBAssistantP
 
PDF
Python Course Functions and Modules Slides
MuhammadIfitikhar
 
PDF
ch-3 funtions - 1 class 12.pdf
zafar578075
 
PPT
Chapter 1.ppt
ethiouniverse
 
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
Maulik Borsaniya
 
Lecture 08.pptx
Mohammad Hassan
 
Python Lecture 4
Inzamam Baig
 
Python functions PYTHON FUNCTIONS1234567
AnjaneyuluKunchala1
 
DS-lect3.data structure in c ++ engineering
abdopro512
 
1P13 Python Review Session Covering various Topics
hussainmuhd1119
 
9 functions.pptxFunction that are used in
divyamth2019
 
Functions
Michael Gordon
 
Vb.net ii
argusacademy
 
Chapter 1 (2) array and structure r.pptx
abenezertekalign118
 
Unit 1-Part-5-Functions and Set Operations.pdf
Harsha Patil
 
Python_Unit-1_PPT_Data Types.pptx
SahajShrimal1
 
Mastering Python lesson 4_functions_parameters_arguments
Ruth Marvin
 
PPT_1_9102501a-a7a1-493e-818f-cf699918bbf6.pptx
myatminsoe180
 
The Ring programming language version 1.3 book - Part 83 of 88
Mahmoud Samir Fayed
 
Types of Handling functions in Python with an example
SubashiniBAssistantP
 
Python Course Functions and Modules Slides
MuhammadIfitikhar
 
ch-3 funtions - 1 class 12.pdf
zafar578075
 
Chapter 1.ppt
ethiouniverse
 
Ad

More from IHTMINSTITUTE (17)

PPTX
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
PPTX
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
PPTX
Python PCEP Creating Simple Functions
IHTMINSTITUTE
 
PPTX
Python PCEP Multidemensional Arrays
IHTMINSTITUTE
 
PPTX
Python PCEP Operations On Lists
IHTMINSTITUTE
 
PPTX
Python PCEP Sorting Simple Lists
IHTMINSTITUTE
 
PPTX
Python PCEP Lists Collections of Data
IHTMINSTITUTE
 
PPTX
Python PCEP Logic Bit Operations
IHTMINSTITUTE
 
PPTX
Python PCEP Loops
IHTMINSTITUTE
 
PPTX
Python PCEP Comparison Operators And Conditional Execution
IHTMINSTITUTE
 
PPTX
Python PCEP How To Talk To Computer
IHTMINSTITUTE
 
PPTX
Python PCEP Variables
IHTMINSTITUTE
 
PPTX
Python PCEP Operators
IHTMINSTITUTE
 
PPTX
Python PCEP Literals
IHTMINSTITUTE
 
PPTX
IHTM Python PCEP Hello World
IHTMINSTITUTE
 
PPTX
IHTM Python PCEP Introduction to Python
IHTMINSTITUTE
 
PPTX
Python PCEP Welcome Opening
IHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Creating Simple Functions
IHTMINSTITUTE
 
Python PCEP Multidemensional Arrays
IHTMINSTITUTE
 
Python PCEP Operations On Lists
IHTMINSTITUTE
 
Python PCEP Sorting Simple Lists
IHTMINSTITUTE
 
Python PCEP Lists Collections of Data
IHTMINSTITUTE
 
Python PCEP Logic Bit Operations
IHTMINSTITUTE
 
Python PCEP Loops
IHTMINSTITUTE
 
Python PCEP Comparison Operators And Conditional Execution
IHTMINSTITUTE
 
Python PCEP How To Talk To Computer
IHTMINSTITUTE
 
Python PCEP Variables
IHTMINSTITUTE
 
Python PCEP Operators
IHTMINSTITUTE
 
Python PCEP Literals
IHTMINSTITUTE
 
IHTM Python PCEP Hello World
IHTMINSTITUTE
 
IHTM Python PCEP Introduction to Python
IHTMINSTITUTE
 
Python PCEP Welcome Opening
IHTMINSTITUTE
 
Ad

Recently uploaded (20)

PDF
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
PPTX
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
PPTX
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PDF
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
PPTX
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
PDF
Enhancing Parental Roles in Protecting Children from Online Sexual Exploitati...
ICT Frame Magazine Pvt. Ltd.
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PPTX
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
PDF
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PDF
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
Orchestrating things in Angular application
Peter Abraham
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
Enhancing Parental Roles in Protecting Children from Online Sexual Exploitati...
ICT Frame Magazine Pvt. Ltd.
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 

Python PCEP Functions

  • 1. Functions Module 3 Functions, Tuples, Dictionaries, Data processing
  • 2. Module 3 Functions Why do we need functions? • to appear in more than one place the first condition • if a piece of code becomes so large the second condition • the product to be implemented as a set of separately the third condition Decomposition
  • 3. Module 3 Functions Where do the functions come from? built-in functions pre installed modules directly from your code
  • 4. Module 3 Functions Your first function print("Enter a value: ") a = int(input()) print("Enter a value: ") b = int(input()) print("Enter a value: ") c = int(input()) change the message "Please" def function_name(): function_body def message(): print("Enter a value: ")
  • 5. Module 3 Functions How functions work 1 def message(): print("Enter a value: ") print("We start here.") message() print("We end here.") print("We start here.") message() print("We end here.") def message(): print("Enter a value: ")
  • 6. Module 3 Functions How functions work 2 def message(): print("Enter a value: ") message = 1 def message(): print("Enter a value: ") message() a = int(input()) message() b = int(input()) message() c = int(input())
  • 7. Module 3 Functions Key takeaways • is a block of code Function •built-in functions •pre-installed modules •user-defined functions •lambda 4 basic types •def your_function(optional parameters): def