SlideShare a Scribd company logo
1 of 14
Name: Sampad Kar
Student Code: BWU/BTA/22/225
Course Name: Introduction To Python
Programming
Course Code: BSCM303
Group: D
Session: 2023-24
What is a function?
• a function is a sequence of program instructions
that performs a specific task, packaged as a unit.
This unit can then be used in programs wherever
that particular task should be performed.
Why functions are important?
• Functions in programming are essential for
organization, readability, and reusability. They break
down tasks, making code clear and modular.
Functions simplify debugging, enhance flexibility,
and ensure efficient development.
Types Of Functions
Built-in
Functions
User-defined
functions
Anonymous
Functions
What are built-in functions?
• A built-in function is a function that is already available
in a programming language, application, or another tool.
Built-in functions are pre-defined in the programming
language's library.
How to use built-in functions?
• To use a built-in function, simply call it with the
appropriate arguments, like this:
function_name(argument1, argument2).
Examples
• print(), len(),
sum(),max(),list(),str(),pow(),sqrt(),ord(),chr(),reverse(),
isnum(),isalpha()
What are user-defined functions
• User defined functions in Python are functions
that are written by the user. They allow the user to
define custom logic that can be used to perform
specific tasks.
What are user-defined functions
• In Python, a def keyword is used to declare user-
defined functions.
• An indented block of statements follows the
function name and arguments which contains the
body of the function.
• .
Basic Syntax
A return statement is used to end the execution of the
function call and “returns” the result (value of the
expression following the return keyword) to the caller.
Local Variables
• Local variables are those that are initialized within a
function and are unique to that function. It cannot be
accessed outside of the function. Let’s look at how to
make a local variable.
Global Variables
• Global variables are the ones that are defined and
declared outside any function and are not specified to
any function. They can be used by any part of the
program.
What is anonymous function
• An anonymous function in Python is one that has
no name when it is defined.
Example: Lambda Function
it is a process in which a function calls itself
directly or indirectly.
Thank
You

More Related Content

Similar to Python Functions

Chapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptChapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptAmanuelZewdie4
 
5. Functions in C.pdf
5. Functions in C.pdf5. Functions in C.pdf
5. Functions in C.pdfsantosh147365
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C ProgrammingAnil Pokhrel
 
Functions in c
Functions in cFunctions in c
Functions in creshmy12
 
Basics concept of Python : An infographic view!
Basics concept of Python : An infographic view!Basics concept of Python : An infographic view!
Basics concept of Python : An infographic view!cybersuccessseo
 
Computer Sc..pptx
Computer Sc..pptxComputer Sc..pptx
Computer Sc..pptxDIVYANI43
 
Functions in python What are functions. Types of functions.pptx
Functions in python What are functions. Types of functions.pptxFunctions in python What are functions. Types of functions.pptx
Functions in python What are functions. Types of functions.pptxteachtv101
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural ProgrammingDeepam Aggarwal
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1YOGESH SINGH
 
358 33 powerpoint-slides_2-functions_chapter-2
358 33 powerpoint-slides_2-functions_chapter-2358 33 powerpoint-slides_2-functions_chapter-2
358 33 powerpoint-slides_2-functions_chapter-2sumitbardhan
 
FUNCTIONS IN R PROGRAMMING.pptx
FUNCTIONS IN R PROGRAMMING.pptxFUNCTIONS IN R PROGRAMMING.pptx
FUNCTIONS IN R PROGRAMMING.pptxSafnaSaff1
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT03062679929
 
Functions and types of user defined functions in
Functions and types of user defined functions inFunctions and types of user defined functions in
Functions and types of user defined functions inRAMYASREEKUPPALA
 

Similar to Python Functions (20)

Chapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptChapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.ppt
 
10. sub program
10. sub program10. sub program
10. sub program
 
Functions
FunctionsFunctions
Functions
 
5. Functions in C.pdf
5. Functions in C.pdf5. Functions in C.pdf
5. Functions in C.pdf
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
Python functions
Python functionsPython functions
Python functions
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Basics concept of Python : An infographic view!
Basics concept of Python : An infographic view!Basics concept of Python : An infographic view!
Basics concept of Python : An infographic view!
 
Computer Sc..pptx
Computer Sc..pptxComputer Sc..pptx
Computer Sc..pptx
 
Functions in python What are functions. Types of functions.pptx
Functions in python What are functions. Types of functions.pptxFunctions in python What are functions. Types of functions.pptx
Functions in python What are functions. Types of functions.pptx
 
Oop.pptx
Oop.pptxOop.pptx
Oop.pptx
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural Programming
 
Basics of cpp
Basics of cppBasics of cpp
Basics of cpp
 
functions.pptx
functions.pptxfunctions.pptx
functions.pptx
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
358 33 powerpoint-slides_2-functions_chapter-2
358 33 powerpoint-slides_2-functions_chapter-2358 33 powerpoint-slides_2-functions_chapter-2
358 33 powerpoint-slides_2-functions_chapter-2
 
C- language Lecture 4
C- language Lecture 4C- language Lecture 4
C- language Lecture 4
 
FUNCTIONS IN R PROGRAMMING.pptx
FUNCTIONS IN R PROGRAMMING.pptxFUNCTIONS IN R PROGRAMMING.pptx
FUNCTIONS IN R PROGRAMMING.pptx
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Functions and types of user defined functions in
Functions and types of user defined functions inFunctions and types of user defined functions in
Functions and types of user defined functions in
 

More from Brainware University

More from Brainware University (9)

Data Structure - Stacks
Data Structure - StacksData Structure - Stacks
Data Structure - Stacks
 
Basic Logic Gates
Basic Logic GatesBasic Logic Gates
Basic Logic Gates
 
Reduced Instruction Set Computer (RISC)
Reduced Instruction Set Computer (RISC)Reduced Instruction Set Computer (RISC)
Reduced Instruction Set Computer (RISC)
 
Variation Of Parameter (Differential Equations)
Variation Of Parameter (Differential Equations)Variation Of Parameter (Differential Equations)
Variation Of Parameter (Differential Equations)
 
Probability Distribution - Binomial, Exponential and Normal
Probability Distribution - Binomial, Exponential and NormalProbability Distribution - Binomial, Exponential and Normal
Probability Distribution - Binomial, Exponential and Normal
 
Carnot Engine - Thermodynamics
Carnot Engine - ThermodynamicsCarnot Engine - Thermodynamics
Carnot Engine - Thermodynamics
 
Central Tendency - Mean, Median and Mode
Central Tendency - Mean, Median and ModeCentral Tendency - Mean, Median and Mode
Central Tendency - Mean, Median and Mode
 
LAW OF VARIABLE PROPORTIONS
LAW OF VARIABLE PROPORTIONSLAW OF VARIABLE PROPORTIONS
LAW OF VARIABLE PROPORTIONS
 
2D-Arrays
2D-Arrays2D-Arrays
2D-Arrays
 

Recently uploaded

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 

Recently uploaded (20)

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 

Python Functions

  • 1. Name: Sampad Kar Student Code: BWU/BTA/22/225 Course Name: Introduction To Python Programming Course Code: BSCM303 Group: D Session: 2023-24
  • 2.
  • 3. What is a function? • a function is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Why functions are important? • Functions in programming are essential for organization, readability, and reusability. They break down tasks, making code clear and modular. Functions simplify debugging, enhance flexibility, and ensure efficient development.
  • 5. What are built-in functions? • A built-in function is a function that is already available in a programming language, application, or another tool. Built-in functions are pre-defined in the programming language's library. How to use built-in functions? • To use a built-in function, simply call it with the appropriate arguments, like this: function_name(argument1, argument2). Examples • print(), len(), sum(),max(),list(),str(),pow(),sqrt(),ord(),chr(),reverse(), isnum(),isalpha()
  • 6. What are user-defined functions • User defined functions in Python are functions that are written by the user. They allow the user to define custom logic that can be used to perform specific tasks. What are user-defined functions • In Python, a def keyword is used to declare user- defined functions. • An indented block of statements follows the function name and arguments which contains the body of the function. • .
  • 8.
  • 9. A return statement is used to end the execution of the function call and “returns” the result (value of the expression following the return keyword) to the caller.
  • 10. Local Variables • Local variables are those that are initialized within a function and are unique to that function. It cannot be accessed outside of the function. Let’s look at how to make a local variable. Global Variables • Global variables are the ones that are defined and declared outside any function and are not specified to any function. They can be used by any part of the program.
  • 11.
  • 12. What is anonymous function • An anonymous function in Python is one that has no name when it is defined. Example: Lambda Function
  • 13. it is a process in which a function calls itself directly or indirectly.