SlideShare a Scribd company logo
.
Class-XII Computer Science (083)
All the contents used as part of the slides are either self created or from the public domain or textbooks for Class XII.
This presentation is only used for leaning purpose only. Programs used in this presentation are based on Python 3.8.0.
Computational Thinking and Programming - 2
Working with Functions
Passing Strings, Lists, Tuples, Dictionaries to function
S K Mahto, PGT (Computer Science)
J.N.V East Medinipur WB
Working with Functions
Topics to be covered
● Passing Strings to function
● Passing Lists to function
● Passing Tuples to function
● Passing Dictionaries to function
Presented by : S K Mahto, PGT Computer Science
Working with Functions
Passing String to a Function
● String can be passed in a function as argument but it is used as pass by
value. It can be depicted from below program. As it will not change value of
actual argument.
Presented by : S K Mahto, PGT Computer Science
Output :
Sanjay
Working with Functions
Passing List to a Function
● List is mutable data type that’s why it treat as pass by reference.
● It is already discussed in topic Mutable/immutable properties of data
objects.
Presented by : S K Mahto, PGT Computer Science
Output
Working with Functions
Passing Tuple to a Function
● In function call, we have to explicitly define/pass the tuple. It is not required
to specify the data type as tuple in formal argument.
Presented by : S K Mahto, PGT Computer Science
Output
3
Working with Functions
Passing Dictionary to a Function
● In Python, everything is an object, so the dictionary can be passed as an
argument to a function like other variables are passed.
Presented by : S K Mahto, PGT Compuer Science

More Related Content

PDF
Object reusability in python
PDF
I.BEST FIRST SEARCH IN AI
PPTX
Data Structure and Algorithms –Introduction.pptx
PDF
Frequently asked tcs technical interview questions and answers
PDF
I.ITERATIVE DEEPENING DEPTH FIRST SEARCH(ID-DFS) II.INFORMED SEARCH IN ARTIFI...
PDF
I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...
PPTX
Presentation on python data type
PDF
Numeric Data types in Python
Object reusability in python
I.BEST FIRST SEARCH IN AI
Data Structure and Algorithms –Introduction.pptx
Frequently asked tcs technical interview questions and answers
I.ITERATIVE DEEPENING DEPTH FIRST SEARCH(ID-DFS) II.INFORMED SEARCH IN ARTIFI...
I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...
Presentation on python data type
Numeric Data types in Python

What's hot (14)

PDF
Python Tutorial Questions part-1
PPTX
Machine learning libraries with python
PPTX
Intro to python
PPTX
Clean code
PDF
I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...
PDF
Python Data Types
PDF
Hua Shan - 2015 - A Dependency-to-String Model for Chinese-Japanese SMT System
PDF
Combinatorial optimization CO-6
PDF
Data handling CBSE PYTHON CLASS 11
PDF
Namespaces
PPTX
Datastrucure
PDF
Python Fundamentals Class 11
PDF
Response to uspto on the first topic v5
PPT
Designing A Syntax Based Retrieval System03
Python Tutorial Questions part-1
Machine learning libraries with python
Intro to python
Clean code
I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...
Python Data Types
Hua Shan - 2015 - A Dependency-to-String Model for Chinese-Japanese SMT System
Combinatorial optimization CO-6
Data handling CBSE PYTHON CLASS 11
Namespaces
Datastrucure
Python Fundamentals Class 11
Response to uspto on the first topic v5
Designing A Syntax Based Retrieval System03
Ad

Similar to 5 cs xii_python_functions _ passing str list tuple (20)

PDF
Function in Python
PPTX
1 cs xii_python_functions_introduction _types of func
PDF
Functions_21_22.pdf
PDF
Functions.pdf
PDF
Functionscs12 ppt.pdf
PPTX
4 cs xii_python_functions _ properties of data object
PPTX
3 cs xii_python_functions _ parameter passing
PPTX
2 Functions2.pptx
PDF
ESIT135 Problem Solving Using Python Notes of Unit-2 and Unit-3
PPTX
CHAPTER 01 FUNCTION in python class 12th.pptx
PDF
Functions_19_20.pdf
PPTX
cbse class 12 Python Functions2 for class 12 .pptx
PDF
Functions-.pdf
PDF
Unit_2.0_Functions (1).pdfUnit_2.0_Functions (1).pdf
PDF
Functions2.pdf
PPT
User deined functions cbse class xii computer science
PPTX
Functions in Python with all type of arguments
PDF
2-functions.pptx_20240619_085610_0000.pdf
PDF
Python functions
PDF
Python_Functions.pdf
Function in Python
1 cs xii_python_functions_introduction _types of func
Functions_21_22.pdf
Functions.pdf
Functionscs12 ppt.pdf
4 cs xii_python_functions _ properties of data object
3 cs xii_python_functions _ parameter passing
2 Functions2.pptx
ESIT135 Problem Solving Using Python Notes of Unit-2 and Unit-3
CHAPTER 01 FUNCTION in python class 12th.pptx
Functions_19_20.pdf
cbse class 12 Python Functions2 for class 12 .pptx
Functions-.pdf
Unit_2.0_Functions (1).pdfUnit_2.0_Functions (1).pdf
Functions2.pdf
User deined functions cbse class xii computer science
Functions in Python with all type of arguments
2-functions.pptx_20240619_085610_0000.pdf
Python functions
Python_Functions.pdf
Ad

Recently uploaded (20)

PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Institutional Correction lecture only . . .
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Classroom Observation Tools for Teachers
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Institutional Correction lecture only . . .
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
VCE English Exam - Section C Student Revision Booklet
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Cell Types and Its function , kingdom of life
Module 4: Burden of Disease Tutorial Slides S2 2025
Final Presentation General Medicine 03-08-2024.pptx
human mycosis Human fungal infections are called human mycosis..pptx
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Classroom Observation Tools for Teachers
Insiders guide to clinical Medicine.pdf
Microbial diseases, their pathogenesis and prophylaxis
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
102 student loan defaulters named and shamed – Is someone you know on the list?

5 cs xii_python_functions _ passing str list tuple

  • 1. . Class-XII Computer Science (083) All the contents used as part of the slides are either self created or from the public domain or textbooks for Class XII. This presentation is only used for leaning purpose only. Programs used in this presentation are based on Python 3.8.0. Computational Thinking and Programming - 2 Working with Functions Passing Strings, Lists, Tuples, Dictionaries to function S K Mahto, PGT (Computer Science) J.N.V East Medinipur WB
  • 2. Working with Functions Topics to be covered ● Passing Strings to function ● Passing Lists to function ● Passing Tuples to function ● Passing Dictionaries to function Presented by : S K Mahto, PGT Computer Science
  • 3. Working with Functions Passing String to a Function ● String can be passed in a function as argument but it is used as pass by value. It can be depicted from below program. As it will not change value of actual argument. Presented by : S K Mahto, PGT Computer Science Output : Sanjay
  • 4. Working with Functions Passing List to a Function ● List is mutable data type that’s why it treat as pass by reference. ● It is already discussed in topic Mutable/immutable properties of data objects. Presented by : S K Mahto, PGT Computer Science Output
  • 5. Working with Functions Passing Tuple to a Function ● In function call, we have to explicitly define/pass the tuple. It is not required to specify the data type as tuple in formal argument. Presented by : S K Mahto, PGT Computer Science Output 3
  • 6. Working with Functions Passing Dictionary to a Function ● In Python, everything is an object, so the dictionary can be passed as an argument to a function like other variables are passed. Presented by : S K Mahto, PGT Compuer Science