SlideShare a Scribd company logo
Module 3 Functions, Tuples, Dictionaries,
Data processing
Function parameters,
Argument passing
Module 3 Function parameters
& Argument passing
Parameterized functions 1
parameters exist only
inside functions in
which they have been
defined
assigning a value to
the parameter is done
at the time of the
function's invocation
parameters live inside
functions
Module 3 Function parameters
& Argument passing
Parameterized functions 2
def message(number):
print("Enter a number:", number)
message()
TypeError: message() missing 1 required
positional argument: 'number'
def message(number):
print("Enter a number:", number)
message(1)
Enter a number: 1
def message(what, number):
print("Enter", what, "number", number)
message("telephone", 11)
message("price", 5)
message("number", "number")
Enter telephone number 11
Enter price number 5
Enter number number number
Module 3 Function parameters
& Argument passing
Positional parameter passing
def my_function(a, b, c):
print(a, b, c)
my_function(1, 2, 3)
def introduction(first_name, last_name):
print("Hello, my name is", first_name, last_name)
introduction("Luke", "Skywalker")
introduction("Jesse", "Quick")
introduction("Clark", "Kent")
Hello, my name is Luke Skywalker
Hello, my name is Jesse Quick
Hello, my name is Clark Kent
Module 3 Function parameters
& Argument passing
Keyword argument passing
def introduction(first_name, last_name):
print("Hello, my name is", first_name, last_name)
introduction(first_name = "James", last_name = "Bond")
introduction(last_name = "Skywalker", first_name = "Luke")
Module 3 Function parameters
& Argument passing
Mixing positional&keyword arguments
positional arguments before keyword arguments
def adding(a, b, c):
print(a, "+", b, "+", c, "=", a + b + c)
# Call the adding function
• adding(1, 2, 3)
positional
• adding(c = 1, a = 2, b = 3)
keyword
• adding(3, c = 1, b = 2)
mix
Module 3 Function parameters
& Argument passing
Parametrized functions
def introduction(first_name, last_name="Smith"):
print("Hello, my name is", first_name, last_name)
introduction("Henry")
introduction(first_name="William")
introduction("James", "Doe")
def introduction(first_name="John", last_name="Smith"):
print("Hello, my name is", first_name, last_name)
Module 3 Function parameters
& Argument passing
Key takeaways
You can pass information to functions by using
parameters.
You can pass arguments to a function using the
following techniques:
• positional argument passing
• keyword (named) argument passing
• a mix of positional and keyword argument passing
You can use the keyword argument passing
technique to pre-define a value for a given argument.
Ad

Recommended

PDF
Python Functions (PyAtl Beginners Night)
Rick Copeland
 
PDF
Functions in python
Ilian Iliev
 
PPTX
Functions in python3
Lakshmi Sarvani Videla
 
PDF
Class 7a: Functions
Marc Gouw
 
PDF
FUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCE
Venugopalavarma Raja
 
PDF
Introduction to python
Marian Marinov
 
PPT
Oop lecture8
Shahriar Robbani
 
PPTX
Python PCEP Functions And Scopes
IHTMINSTITUTE
 
PPTX
Python
Sameeksha Verma
 
PDF
Python Modules, Packages and Libraries
Venugopalavarma Raja
 
PPTX
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
PDF
iRODS Rule Language Cheat Sheet
Samuel Lampa
 
PPTX
Python programing
hamzagame
 
PDF
Protocols
SV.CO
 
PPTX
Pointers in c
CHANDAN KUMAR
 
PDF
Python Usage (5-minute-summary)
Ohgyun Ahn
 
PDF
Python-Tuples
Krishna Nanda
 
PPTX
Introduction to Python and TensorFlow
Bayu Aldi Yansyah
 
PPTX
Python Modules and Libraries
Venugopalavarma Raja
 
PDF
Functions
Marieswaran Ramasamy
 
PPTX
Python Course for Beginners
Nandakumar P
 
ODP
Very basic functional design patterns
Tomasz Kowal
 
PPTX
Pragmatic metaprogramming
Mårten Rånge
 
PDF
The Error of Our Ways
Kevlin Henney
 
ODP
Python quickstart for programmers: Python Kung Fu
climatewarrior
 
PDF
1 pythonbasic
pramod naik
 
PDF
The Ring programming language version 1.7 book - Part 35 of 196
Mahmoud Samir Fayed
 
PPTX
Python basic
sewoo lee
 
PDF
Chapter Functions for grade 12 computer Science
KrithikaTM
 
PPTX
Lecture 08.pptx
Mohammad Hassan
 

More Related Content

What's hot (20)

PPTX
Python
Sameeksha Verma
 
PDF
Python Modules, Packages and Libraries
Venugopalavarma Raja
 
PPTX
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
PDF
iRODS Rule Language Cheat Sheet
Samuel Lampa
 
PPTX
Python programing
hamzagame
 
PDF
Protocols
SV.CO
 
PPTX
Pointers in c
CHANDAN KUMAR
 
PDF
Python Usage (5-minute-summary)
Ohgyun Ahn
 
PDF
Python-Tuples
Krishna Nanda
 
PPTX
Introduction to Python and TensorFlow
Bayu Aldi Yansyah
 
PPTX
Python Modules and Libraries
Venugopalavarma Raja
 
PDF
Functions
Marieswaran Ramasamy
 
PPTX
Python Course for Beginners
Nandakumar P
 
ODP
Very basic functional design patterns
Tomasz Kowal
 
PPTX
Pragmatic metaprogramming
Mårten Rånge
 
PDF
The Error of Our Ways
Kevlin Henney
 
ODP
Python quickstart for programmers: Python Kung Fu
climatewarrior
 
PDF
1 pythonbasic
pramod naik
 
PDF
The Ring programming language version 1.7 book - Part 35 of 196
Mahmoud Samir Fayed
 
PPTX
Python basic
sewoo lee
 
Python Modules, Packages and Libraries
Venugopalavarma Raja
 
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
iRODS Rule Language Cheat Sheet
Samuel Lampa
 
Python programing
hamzagame
 
Protocols
SV.CO
 
Pointers in c
CHANDAN KUMAR
 
Python Usage (5-minute-summary)
Ohgyun Ahn
 
Python-Tuples
Krishna Nanda
 
Introduction to Python and TensorFlow
Bayu Aldi Yansyah
 
Python Modules and Libraries
Venugopalavarma Raja
 
Python Course for Beginners
Nandakumar P
 
Very basic functional design patterns
Tomasz Kowal
 
Pragmatic metaprogramming
Mårten Rånge
 
The Error of Our Ways
Kevlin Henney
 
Python quickstart for programmers: Python Kung Fu
climatewarrior
 
1 pythonbasic
pramod naik
 
The Ring programming language version 1.7 book - Part 35 of 196
Mahmoud Samir Fayed
 
Python basic
sewoo lee
 

Similar to Python PCEP Function Parameters (20)

PDF
Chapter Functions for grade 12 computer Science
KrithikaTM
 
PPTX
Lecture 08.pptx
Mohammad Hassan
 
PPTX
Python functions PYTHON FUNCTIONS1234567
AnjaneyuluKunchala1
 
PPTX
UNIT- 2 PPDS R20.pptx
ssuser688516
 
PPTX
Python PCEP Functions
IHTMINSTITUTE
 
PDF
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
Yashpatel821746
 
PDF
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Yashpatel821746
 
PDF
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
Yashpatel821746
 
PPT
Function in Python [Autosaved].ppt
GaganvirKaur
 
PPTX
Python for Data Science function third module ppt.pptx
bmit1
 
PPTX
Python 표준 라이브러리
용 최
 
PPT
functions modules and exceptions handlings.ppt
Rajasekhar364622
 
PDF
Notes5
hccit
 
PPTX
Working with functions.pptx. Hb.
sabarivelan111007
 
PPTX
Viii session
AliMohammad155
 
PPTX
Python functions part11
Vishal Dutt
 
ODP
Python course Day 1
Karin Lagesen
 
PPTX
CHAPTER 01 FUNCTION in python class 12th.pptx
PreeTVithule1
 
PDF
The Ring programming language version 1.3 book - Part 13 of 88
Mahmoud Samir Fayed
 
PPTX
Python_Functions_Unit1.pptx
Koteswari Kasireddy
 
Chapter Functions for grade 12 computer Science
KrithikaTM
 
Lecture 08.pptx
Mohammad Hassan
 
Python functions PYTHON FUNCTIONS1234567
AnjaneyuluKunchala1
 
UNIT- 2 PPDS R20.pptx
ssuser688516
 
Python PCEP Functions
IHTMINSTITUTE
 
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
Yashpatel821746
 
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Yashpatel821746
 
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
Yashpatel821746
 
Function in Python [Autosaved].ppt
GaganvirKaur
 
Python for Data Science function third module ppt.pptx
bmit1
 
Python 표준 라이브러리
용 최
 
functions modules and exceptions handlings.ppt
Rajasekhar364622
 
Notes5
hccit
 
Working with functions.pptx. Hb.
sabarivelan111007
 
Viii session
AliMohammad155
 
Python functions part11
Vishal Dutt
 
Python course Day 1
Karin Lagesen
 
CHAPTER 01 FUNCTION in python class 12th.pptx
PreeTVithule1
 
The Ring programming language version 1.3 book - Part 13 of 88
Mahmoud Samir Fayed
 
Python_Functions_Unit1.pptx
Koteswari Kasireddy
 
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
ChatGPT A.I. Powered Chatbot and Popularization.pdf
StanleySamson1
 
PPTX
最新版美国特拉华大学毕业证(UDel毕业证书)原版定制
taqyea
 
PDF
Transmission Control Protocol (TCP) and Starlink
APNIC
 
PPTX
Azure_Landing_Zone_Best_Practices_Visuals.pptx
fredsonbarbosa1
 
PPTX
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
PPTX
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
PDF
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 
PDF
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
PDF
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 
PPTX
BASICS OF SAP _ ALL ABOUT SAP _WHY SAP OVER ANY OTHER ERP SYSTEM
AhmadAli716831
 
PDF
DDoS in India, presented at INNOG 8 by Dave Phelan
APNIC
 
PDF
Logging and Automated Alerting Webinar.pdf
ControlCase
 
PPTX
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
PPTX
原版澳洲斯文本科技大学毕业证(SUT毕业证书)如何办理
taqyed
 
PDF
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
PDF
Paper: The World Game (s) Great Redesign.pdf
Steven McGee
 
PPTX
Pitch PitchPitchPitchPitchPitchPitch.pptx
157551
 
PPTX
IAREUOUSTPIDWHY$)CHARACTERARERWUEEJJSKWNSND
notgachabite123
 
PPTX
最新版加拿大奎斯特大学毕业证(QUC毕业证书)原版定制
taqyed
 
PPTX
ChatGPT_and_Its_Uses_Presentationss.pptx
Neha Prakash
 
ChatGPT A.I. Powered Chatbot and Popularization.pdf
StanleySamson1
 
最新版美国特拉华大学毕业证(UDel毕业证书)原版定制
taqyea
 
Transmission Control Protocol (TCP) and Starlink
APNIC
 
Azure_Landing_Zone_Best_Practices_Visuals.pptx
fredsonbarbosa1
 
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 
BASICS OF SAP _ ALL ABOUT SAP _WHY SAP OVER ANY OTHER ERP SYSTEM
AhmadAli716831
 
DDoS in India, presented at INNOG 8 by Dave Phelan
APNIC
 
Logging and Automated Alerting Webinar.pdf
ControlCase
 
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
原版澳洲斯文本科技大学毕业证(SUT毕业证书)如何办理
taqyed
 
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
Paper: The World Game (s) Great Redesign.pdf
Steven McGee
 
Pitch PitchPitchPitchPitchPitchPitch.pptx
157551
 
IAREUOUSTPIDWHY$)CHARACTERARERWUEEJJSKWNSND
notgachabite123
 
最新版加拿大奎斯特大学毕业证(QUC毕业证书)原版定制
taqyed
 
ChatGPT_and_Its_Uses_Presentationss.pptx
Neha Prakash
 

Python PCEP Function Parameters

  • 1. Module 3 Functions, Tuples, Dictionaries, Data processing Function parameters, Argument passing
  • 2. Module 3 Function parameters & Argument passing Parameterized functions 1 parameters exist only inside functions in which they have been defined assigning a value to the parameter is done at the time of the function's invocation parameters live inside functions
  • 3. Module 3 Function parameters & Argument passing Parameterized functions 2 def message(number): print("Enter a number:", number) message() TypeError: message() missing 1 required positional argument: 'number' def message(number): print("Enter a number:", number) message(1) Enter a number: 1 def message(what, number): print("Enter", what, "number", number) message("telephone", 11) message("price", 5) message("number", "number") Enter telephone number 11 Enter price number 5 Enter number number number
  • 4. Module 3 Function parameters & Argument passing Positional parameter passing def my_function(a, b, c): print(a, b, c) my_function(1, 2, 3) def introduction(first_name, last_name): print("Hello, my name is", first_name, last_name) introduction("Luke", "Skywalker") introduction("Jesse", "Quick") introduction("Clark", "Kent") Hello, my name is Luke Skywalker Hello, my name is Jesse Quick Hello, my name is Clark Kent
  • 5. Module 3 Function parameters & Argument passing Keyword argument passing def introduction(first_name, last_name): print("Hello, my name is", first_name, last_name) introduction(first_name = "James", last_name = "Bond") introduction(last_name = "Skywalker", first_name = "Luke")
  • 6. Module 3 Function parameters & Argument passing Mixing positional&keyword arguments positional arguments before keyword arguments def adding(a, b, c): print(a, "+", b, "+", c, "=", a + b + c) # Call the adding function • adding(1, 2, 3) positional • adding(c = 1, a = 2, b = 3) keyword • adding(3, c = 1, b = 2) mix
  • 7. Module 3 Function parameters & Argument passing Parametrized functions def introduction(first_name, last_name="Smith"): print("Hello, my name is", first_name, last_name) introduction("Henry") introduction(first_name="William") introduction("James", "Doe") def introduction(first_name="John", last_name="Smith"): print("Hello, my name is", first_name, last_name)
  • 8. Module 3 Function parameters & Argument passing Key takeaways You can pass information to functions by using parameters. You can pass arguments to a function using the following techniques: • positional argument passing • keyword (named) argument passing • a mix of positional and keyword argument passing You can use the keyword argument passing technique to pre-define a value for a given argument.