SlideShare a Scribd company logo
1 of 13
Download to read offline
Module : M04
By
SachinVasantrao Inkane
PGT, AECS,Indore
Python Built-in Core Data Types
Python offers following built-in core data types :
i) Numbers ii) String iii) List iv) Tuple v) Dictionary
Built-in Core Data Types
Numbers
Integers
Integers(Signed)
Boolean
Floating-Point
Numbers
Complex
Numbers
String List Tuple Dictionary
Integers
Integers are whole numbers. They have no fractional parts.
Integers can be positive or negative.
There are two types of integers in Python:
i) Integers(Signed) : It is the normal integer representation of
whole numbers using the digits 0 to 9. Python provides
single int data type to store any integer whether big or small.
It is signed representation i.e. it can be positive or negative.
ii) Boolean : These represent the truth values True and False. It
is a subtype of integers and Boolean values True and False
corresponds to values 1 and 0 respectively
Demonstration of Integer Data Type
#Demonstration of Integer-Addition of two integer number
a=int(input("Enter the value of a:"))
b=int(input("Enter the value of b:"))
sum=a+b
print("The sum of two integers=",sum)
Output:
Enter the value of a: 45
Enter the value of b: 67
The sum of two integers= 112
Floating Point Numbers
A number having fractional part is a floating point number.
It has a decimal point. It is written in two forms :
i) Fractional Form : Normal decimal notation e.g. 675.456
ii) Exponent Notation: It has mantissa and exponent.
e.g. 6.75456E2
Advantage of Floating point numbers:
They can represent values between the integers.
They can represent a much greater range of values.
Disadvantage of Floating point numbers:
Floating-point operations are usually slower than integer
operations.
Demonstration of Floating Point Data Type
#Demonstration of Float Number- Calculate Simple Interest
princ=float(input("Enter the Principal Amount:"))
rate=float(input("Enter the Rate of interest:"))
time=float(input("Enter the Time period:"))
si=(princ*rate*time)/100
print("The Simple Interest=",si)
Output:
Enter the Principal Amount:5000
Enter the Rate of interest:8.5
Enter the Time period:5.5
Simple Interest= 2337.5
Complex Number
Python represents complex numbers in the form a+bj.
#Demonstration of Complex Number- Sum of two Complex
Numbers
a=7+8j
b=3.1+6j
c=a+b
print("Sum of two Complex Numbers")
print(a,"+",b,"=",c)
Output:
(7+8j) + (3.1+6j) = (10.1+14j)
Strings
A String is a group of valid characters enclosed in Single or
Double quotation marks. A string can group any type of known
characters i.e. letters ,numbers and special characters.
A Python string is a sequence of characters and each character
can be accessed by its index either by forward indexing or by
backward indexing.
e.g. subj=“Computer”
Forward indexing
Subj
Backward indexing
0 1 2 3 4 5 6 7
C o m p u t e r
-8 -7 -6 -5 -4 -3 -2 -1
Demonstration of String Data Type
#Demonstration of String- To input string & print it
my_name=input("What is your Name? :")
print("Greetings!!!")
print("Hello!",my_name)
print("How do you do?")
Output :
What is your Name? :Ananya Inkane
Greetings!!!
Hello! Ananya Inkane
How do you do?
List
The List is Python’s compound data type. A List in Python
represents a list of comma separated values of any data type
between square brackets. Lists are Mutable.
#Demonstration of List- Program to input 2 list & join it
List1=eval(input("Enter Elements for List 1:"))
List2=eval(input("Enter Elements for List 2:"))
List=List1+List2
print("List 1 :",List1)
print("List 2 :",List2)
print("Joined List :",List)
Output:
Enter Elements for List 1:[12,78,45,30]
Enter Elements for List 2:[80,50,56,77,95]
List 1 : [12, 78, 45, 30]
List 2 : [80, 50, 56, 77, 95]
Joined List : [12, 78, 45, 30, 80, 50, 56, 77, 95]
Tuple
The Tuple is Python’s compound data type. A Tuple in Python
represents a list of comma separated values of any data type
Within parentheses. Tuples are Immutable.
#Demonstration of Tuple- Program to input 2 tuple & join it
tuple1=eval(input("Enter Elements for Tuple 1:"))
tuple2=eval(input("Enter Elements for Tuple 2:"))
Tuple=tuple1+tuple2
print(“Tuple 1 :“,tuple1)
print(“Tuple 2 :“,tuple2)
print("Joined Tuple :“,Tuple)
Output:
Enter Elements for Tuple 1:(12,78,45,30)
Enter Elements for Tuple 2:(80,50,56,77,95)
List 1 : (12, 78, 45, 30)
List 2 : (80, 50, 56, 77, 95)
Joined List : (12, 78, 45, 30, 80, 50, 56, 77, 95)
Dictionary
Dictionaries are unordered collection of elements in curly braces in the form of
a key:value pairs that associate keys to values. Dictionaries are Mutable. As
dictionary elements does not have index value ,the elements are accessed
through the keys defined in key:value pairs.
#Demonstration of Dictionary- Program to save Phone nos. in dictionary &
print it
Phonedict={“Madhav”:9876567843,”Dilpreet”:7650983457,”Murugan”:90672
08769,”Abhinav”:9870987067}
print(Phonedict)
Output:
{'Madhav': 9876567843, 'Dilpreet': 7650983457, 'Murugan': 9067208769,
'Abhinav': 9870987067}
References: 1)Computer Science with Python By Sumita Arora
2)https://www.tutorialsteacher.com/python/statistics-module
3)CBSE Revised Syllabus

More Related Content

Similar to types.pdf

Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdfsimenehanmut
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxlemonchoos
 
Python data type
Python data typePython data type
Python data typeJaya Kumari
 
‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptxRamiHarrathi1
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in pythonJothi Thilaga P
 
Python programming workshop
Python programming workshopPython programming workshop
Python programming workshopBAINIDA
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumarSujith Kumar
 
Introduction to python programming ( part-3 )
Introduction to python programming ( part-3 )Introduction to python programming ( part-3 )
Introduction to python programming ( part-3 )Ziyauddin Shaik
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data typeswati kushwaha
 
week4_python.docx
week4_python.docxweek4_python.docx
week4_python.docxRadhe Syam
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdfCBJWorld
 
python_lab_manual_final (1).pdf
python_lab_manual_final (1).pdfpython_lab_manual_final (1).pdf
python_lab_manual_final (1).pdfkeerthu0442
 

Similar to types.pdf (20)

Python 3.pptx
Python 3.pptxPython 3.pptx
Python 3.pptx
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
 
ECE-PYTHON.docx
ECE-PYTHON.docxECE-PYTHON.docx
ECE-PYTHON.docx
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptx
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
Python data type
Python data typePython data type
Python data type
 
Python
PythonPython
Python
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
 
Python programming workshop
Python programming workshopPython programming workshop
Python programming workshop
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
MODULE. .pptx
MODULE.                              .pptxMODULE.                              .pptx
MODULE. .pptx
 
Introduction to python programming ( part-3 )
Introduction to python programming ( part-3 )Introduction to python programming ( part-3 )
Introduction to python programming ( part-3 )
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
 
python
pythonpython
python
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
week4_python.docx
week4_python.docxweek4_python.docx
week4_python.docx
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdf
 
python_lab_manual_final (1).pdf
python_lab_manual_final (1).pdfpython_lab_manual_final (1).pdf
python_lab_manual_final (1).pdf
 

More from Venkateswara Babu Ravipati (12)

EG-Unit-2- Points.pptx
EG-Unit-2- Points.pptxEG-Unit-2- Points.pptx
EG-Unit-2- Points.pptx
 
EG- Unit 1.pptx
EG- Unit 1.pptxEG- Unit 1.pptx
EG- Unit 1.pptx
 
Chapter5.pptx
Chapter5.pptxChapter5.pptx
Chapter5.pptx
 
inputoutput.pptx
inputoutput.pptxinputoutput.pptx
inputoutput.pptx
 
PP ECE A Sec UNIT-1.pptx
PP ECE A Sec UNIT-1.pptxPP ECE A Sec UNIT-1.pptx
PP ECE A Sec UNIT-1.pptx
 
python unit 2.pptx
python unit 2.pptxpython unit 2.pptx
python unit 2.pptx
 
Data types.pdf
Data types.pdfData types.pdf
Data types.pdf
 
6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx
 
cad cam and robotics.pptx
cad cam and robotics.pptxcad cam and robotics.pptx
cad cam and robotics.pptx
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
 
Le and ne algorithms
Le and ne algorithmsLe and ne algorithms
Le and ne algorithms
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 

types.pdf

  • 1. Module : M04 By SachinVasantrao Inkane PGT, AECS,Indore
  • 2. Python Built-in Core Data Types Python offers following built-in core data types : i) Numbers ii) String iii) List iv) Tuple v) Dictionary Built-in Core Data Types Numbers Integers Integers(Signed) Boolean Floating-Point Numbers Complex Numbers String List Tuple Dictionary
  • 3. Integers Integers are whole numbers. They have no fractional parts. Integers can be positive or negative. There are two types of integers in Python: i) Integers(Signed) : It is the normal integer representation of whole numbers using the digits 0 to 9. Python provides single int data type to store any integer whether big or small. It is signed representation i.e. it can be positive or negative. ii) Boolean : These represent the truth values True and False. It is a subtype of integers and Boolean values True and False corresponds to values 1 and 0 respectively
  • 4. Demonstration of Integer Data Type #Demonstration of Integer-Addition of two integer number a=int(input("Enter the value of a:")) b=int(input("Enter the value of b:")) sum=a+b print("The sum of two integers=",sum) Output: Enter the value of a: 45 Enter the value of b: 67 The sum of two integers= 112
  • 5. Floating Point Numbers A number having fractional part is a floating point number. It has a decimal point. It is written in two forms : i) Fractional Form : Normal decimal notation e.g. 675.456 ii) Exponent Notation: It has mantissa and exponent. e.g. 6.75456E2 Advantage of Floating point numbers: They can represent values between the integers. They can represent a much greater range of values. Disadvantage of Floating point numbers: Floating-point operations are usually slower than integer operations.
  • 6. Demonstration of Floating Point Data Type #Demonstration of Float Number- Calculate Simple Interest princ=float(input("Enter the Principal Amount:")) rate=float(input("Enter the Rate of interest:")) time=float(input("Enter the Time period:")) si=(princ*rate*time)/100 print("The Simple Interest=",si) Output: Enter the Principal Amount:5000 Enter the Rate of interest:8.5 Enter the Time period:5.5 Simple Interest= 2337.5
  • 7. Complex Number Python represents complex numbers in the form a+bj. #Demonstration of Complex Number- Sum of two Complex Numbers a=7+8j b=3.1+6j c=a+b print("Sum of two Complex Numbers") print(a,"+",b,"=",c) Output: (7+8j) + (3.1+6j) = (10.1+14j)
  • 8. Strings A String is a group of valid characters enclosed in Single or Double quotation marks. A string can group any type of known characters i.e. letters ,numbers and special characters. A Python string is a sequence of characters and each character can be accessed by its index either by forward indexing or by backward indexing. e.g. subj=“Computer” Forward indexing Subj Backward indexing 0 1 2 3 4 5 6 7 C o m p u t e r -8 -7 -6 -5 -4 -3 -2 -1
  • 9. Demonstration of String Data Type #Demonstration of String- To input string & print it my_name=input("What is your Name? :") print("Greetings!!!") print("Hello!",my_name) print("How do you do?") Output : What is your Name? :Ananya Inkane Greetings!!! Hello! Ananya Inkane How do you do?
  • 10. List The List is Python’s compound data type. A List in Python represents a list of comma separated values of any data type between square brackets. Lists are Mutable. #Demonstration of List- Program to input 2 list & join it List1=eval(input("Enter Elements for List 1:")) List2=eval(input("Enter Elements for List 2:")) List=List1+List2 print("List 1 :",List1) print("List 2 :",List2) print("Joined List :",List) Output: Enter Elements for List 1:[12,78,45,30] Enter Elements for List 2:[80,50,56,77,95] List 1 : [12, 78, 45, 30] List 2 : [80, 50, 56, 77, 95] Joined List : [12, 78, 45, 30, 80, 50, 56, 77, 95]
  • 11. Tuple The Tuple is Python’s compound data type. A Tuple in Python represents a list of comma separated values of any data type Within parentheses. Tuples are Immutable. #Demonstration of Tuple- Program to input 2 tuple & join it tuple1=eval(input("Enter Elements for Tuple 1:")) tuple2=eval(input("Enter Elements for Tuple 2:")) Tuple=tuple1+tuple2 print(“Tuple 1 :“,tuple1) print(“Tuple 2 :“,tuple2) print("Joined Tuple :“,Tuple) Output: Enter Elements for Tuple 1:(12,78,45,30) Enter Elements for Tuple 2:(80,50,56,77,95) List 1 : (12, 78, 45, 30) List 2 : (80, 50, 56, 77, 95) Joined List : (12, 78, 45, 30, 80, 50, 56, 77, 95)
  • 12. Dictionary Dictionaries are unordered collection of elements in curly braces in the form of a key:value pairs that associate keys to values. Dictionaries are Mutable. As dictionary elements does not have index value ,the elements are accessed through the keys defined in key:value pairs. #Demonstration of Dictionary- Program to save Phone nos. in dictionary & print it Phonedict={“Madhav”:9876567843,”Dilpreet”:7650983457,”Murugan”:90672 08769,”Abhinav”:9870987067} print(Phonedict) Output: {'Madhav': 9876567843, 'Dilpreet': 7650983457, 'Murugan': 9067208769, 'Abhinav': 9870987067}
  • 13. References: 1)Computer Science with Python By Sumita Arora 2)https://www.tutorialsteacher.com/python/statistics-module 3)CBSE Revised Syllabus