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

What's hot

Python Tutorial Questions part-1
Python Tutorial Questions part-1Python Tutorial Questions part-1
Python Tutorial Questions part-1
Srinimf-Slides
 
Machine learning libraries with python
Machine learning libraries with pythonMachine learning libraries with python
Machine learning libraries with python
VishalBisht9217
 
Intro to python
Intro to pythonIntro to python
Intro to python
Mohamed Essam
 
Clean code
Clean codeClean code
Clean code
Smita Prasad
 
I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...
I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...
I.INFORMED SEARCH IN ARTIFICIAL INTELLIGENCE II. HEURISTIC FUNCTION IN AI III...
vikas dhakane
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
athithanvijay
 
Hua Shan - 2015 - A Dependency-to-String Model for Chinese-Japanese SMT System
Hua Shan - 2015 - A Dependency-to-String Model for Chinese-Japanese SMT SystemHua Shan - 2015 - A Dependency-to-String Model for Chinese-Japanese SMT System
Hua Shan - 2015 - A Dependency-to-String Model for Chinese-Japanese SMT System
Association for Computational Linguistics
 
Combinatorial optimization CO-6
Combinatorial optimization CO-6Combinatorial optimization CO-6
Combinatorial optimization CO-6
man003
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
chinthala Vijaya Kumar
 
Namespaces
NamespacesNamespaces
Namespaces
Sangeetha S
 
Datastrucure
DatastrucureDatastrucure
Datastrucure
Mohamed Essam
 
Python Fundamentals Class 11
Python Fundamentals Class 11Python Fundamentals Class 11
Python Fundamentals Class 11
chinthala Vijaya Kumar
 
Response to uspto on the first topic v5
Response to uspto on the first topic   v5Response to uspto on the first topic   v5
Response to uspto on the first topic v5
getsocialize
 
Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03
Avelin Huo
 

What's hot (14)

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

Similar to 5 cs xii_python_functions _ passing str list tuple

1 cs xii_python_functions_introduction _types of func
1 cs xii_python_functions_introduction _types of func1 cs xii_python_functions_introduction _types of func
1 cs xii_python_functions_introduction _types of func
SanjayKumarMahto1
 
3 cs xii_python_functions _ parameter passing
3 cs xii_python_functions _ parameter passing3 cs xii_python_functions _ parameter passing
3 cs xii_python_functions _ parameter passing
SanjayKumarMahto1
 
4 cs xii_python_functions _ properties of data object
4 cs xii_python_functions _ properties of data object4 cs xii_python_functions _ properties of data object
4 cs xii_python_functions _ properties of data object
SanjayKumarMahto1
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
Chariza Pladin
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
Shubham Yadav
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
ParrotAI
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
Asst.prof M.Gokilavani
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTES
Rushikesh Kolhe
 
2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes
SanjayKumarMahto1
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologies
Polad Saruxanov
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
UpasnaSharma37
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming Language
MansiSuthar3
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
AdnanAhmad57885
 
trisha comp ppt.pptx
trisha comp ppt.pptxtrisha comp ppt.pptx
trisha comp ppt.pptx
Tapaswini14
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
jaba kumar
 
Introduction to Analytics with Azure Notebooks and Python
Introduction to Analytics with Azure Notebooks and PythonIntroduction to Analytics with Azure Notebooks and Python
Introduction to Analytics with Azure Notebooks and Python
Jen Stirrup
 
ilovepdf_merged pdfggjhfgyutertyuiuytrsj
ilovepdf_merged pdfggjhfgyutertyuiuytrsjilovepdf_merged pdfggjhfgyutertyuiuytrsj
ilovepdf_merged pdfggjhfgyutertyuiuytrsj
gautamkumar88905
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
Samir Mohanty
 
The Great Debate.pdf
The Great Debate.pdfThe Great Debate.pdf
The Great Debate.pdf
SudhanshiBakre1
 
Intro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdfIntro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdf
ssuser543728
 

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

1 cs xii_python_functions_introduction _types of func
1 cs xii_python_functions_introduction _types of func1 cs xii_python_functions_introduction _types of func
1 cs xii_python_functions_introduction _types of func
 
3 cs xii_python_functions _ parameter passing
3 cs xii_python_functions _ parameter passing3 cs xii_python_functions _ parameter passing
3 cs xii_python_functions _ parameter passing
 
4 cs xii_python_functions _ properties of data object
4 cs xii_python_functions _ properties of data object4 cs xii_python_functions _ properties of data object
4 cs xii_python_functions _ properties of data object
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTES
 
2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologies
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming Language
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
 
trisha comp ppt.pptx
trisha comp ppt.pptxtrisha comp ppt.pptx
trisha comp ppt.pptx
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
Introduction to Analytics with Azure Notebooks and Python
Introduction to Analytics with Azure Notebooks and PythonIntroduction to Analytics with Azure Notebooks and Python
Introduction to Analytics with Azure Notebooks and Python
 
ilovepdf_merged pdfggjhfgyutertyuiuytrsj
ilovepdf_merged pdfggjhfgyutertyuiuytrsjilovepdf_merged pdfggjhfgyutertyuiuytrsj
ilovepdf_merged pdfggjhfgyutertyuiuytrsj
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
 
The Great Debate.pdf
The Great Debate.pdfThe Great Debate.pdf
The Great Debate.pdf
 
Intro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdfIntro-to-Python-Part-1-first-part-edition.pdf
Intro-to-Python-Part-1-first-part-edition.pdf
 

Recently uploaded

Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
Celine George
 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
khabri85
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
Kalna College
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
lakshayrojroj
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
FinalSD_MathematicsGrade7_Session2_Unida.pptx
FinalSD_MathematicsGrade7_Session2_Unida.pptxFinalSD_MathematicsGrade7_Session2_Unida.pptx
FinalSD_MathematicsGrade7_Session2_Unida.pptx
JennySularte1
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
ShwetaGawande8
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
TechSoup
 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
Kalna College
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGHKHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
shreyassri1208
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
OH TEIK BIN
 
adjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammaradjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammar
7DFarhanaMohammed
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
FinalSD_MathematicsGrade7_Session2_Unida.pptx
FinalSD_MathematicsGrade7_Session2_Unida.pptxFinalSD_MathematicsGrade7_Session2_Unida.pptx
FinalSD_MathematicsGrade7_Session2_Unida.pptx
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGHKHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
 
adjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammaradjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammar
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
 

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