SlideShare a Scribd company logo
1 of 21
Data types
Number Sequence
None Set
Integer Float Complex
String Tuple List
Dictionary
Number data types store numeric values.
They are immutable data types, means that
changing the value of a number data type
results in a newly allocated object.
There are three numeric types to
present numbers-
Integer
Float
Complex
1
2
3
An integer is a whole number with no decimal
places. For example, 1 is an integer, but 1.0 isn’t.
The name for the integer data type is int.
Ex- type(1) <class 'int'>
A floating-point number, or float for short, is a
number with a decimal place. 1.0 is a floating-point
number, as is -2.75.
Ex- type(1.0) <class 'float'>
complex fare of the form a + bJ, where a and b are
floats and J (or j) represents the square root of -1
(which is an imaginary number). The real part of the
number is a, and the imaginary part is b. Complex
numbers are not used much in Python programming.
Ex- type(1+2j) <class 'float'>
The None keyword is used to define a null
value, or no value at all.
None is not the same as 0, False, or an
empty string. None is a data type of its own
(NoneType) and only None can be None.
x = None
if x:
print("Do you think None is True?")
elif x is False:
print ("Do you think None is False?")
else:
print("None is not True, or False, None is just None...")
Output-None is not True, or False, None is just None...
Sequences allow you to store multiple
values in an organized and efficient
fashion
String are arrays of bytes representing Unicode
characters. A string is a collection of one or
more characters put in a single quote, double-
quote or triple quote. In python there is no
character data type, a character is a string of
length one. It is represented by str class.
To Access characters of String
String1 = “Python"
print("Initial String: ")
print(String1)
print("nFirst character of
String is: ")
print(String1[0])
Output-
Initial String:
Python
Output-
First character
of String is: P
A tuple is also a heterogeneous collection of
python objects seperated by commas .It means
object of different data types can consist of
tuple.
Ex- first_tuple=(2,3,4,6)
Python has two built-in methods that you can use on tuples.
 Count()- Returns the number of times a specified value
occurs in a tuple.
 Index()- Searches the tuple for a specified value and
retuns the position of where it was found.
It is a heterogeneous collection of items of varied
data types. For Ex, a list object can store files in a
folder or the employee data in a company etc.
Ex- List=[1,2,3,4]
O/P-List=[“Annu”, ”Mini”, 33, 44]
//Heterogeneous collection of items
Insert()
Remove()
Count()
Clear()
Add an element at the specified position
Removes the fist item with the specified value.
Returns the number of elements with the
specified value.
Removes all the elements from the list.
A set is an unordered collection of unique and immutable
objects. Its definition starts with enclosed braces {} having
its items separated by commas inside.
Creating a set-
Set1={“BMW”, “Ferrari”, “Tesla”, “Ford”, ”Honda”}
Set2={Honda”,”Yamaha”,”Kawasaki”,20,40}
 Union()- Return a set that contatins all items from both
sets, duplicates are excluded.
 Intersection()- The intersection() method returns a set that
contains the similarity between two or more sets.
 Difference()- Return the difference two sets which is also
a set.
 Issubset()- The issubset() method returns True if all items
in the items in the set exists in the specidied set,
otherwise it return false.
A dictionary in Python is an unordered collection of key-value pairs.
Accessing values
Print(Dict1[Roll_No])
// output Dict1[Roll_No]) : 101
Print(Dict1[‘Name’])
// output Dict1[‘Name’]) : Kajal
Ex- Dict1= {
“Roll_No” : 101
“Name” : “Kajal”,
“Caste” : “Soni”,
“Class” : 12
}
 Get()-Returns the value of the specified key.
 Update()- Updates the dictionary with the specified key-vlaue
pairs.
 Pop()- Removes the element with the specified key.
 Copy()- Returns a copy of the dictionary.
Data types in python

More Related Content

What's hot (20)

Python programming : Classes objects
Python programming : Classes objectsPython programming : Classes objects
Python programming : Classes objects
 
List in Python
List in PythonList in Python
List in Python
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
 
Python: Modules and Packages
Python: Modules and PackagesPython: Modules and Packages
Python: Modules and Packages
 
Python list
Python listPython list
Python list
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
Looping statement in python
Looping statement in pythonLooping statement in python
Looping statement in python
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Arrays
ArraysArrays
Arrays
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
 
Data types in C
Data types in CData types in C
Data types in C
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 

Similar to Data types in python

Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumarSujith Kumar
 
Python variables and data types.pptx
Python variables and data types.pptxPython variables and data types.pptx
Python variables and data types.pptxAkshayAggarwal79
 
Python Data Types.pdf
Python Data Types.pdfPython Data Types.pdf
Python Data Types.pdfNehaSpillai1
 
Python Data Types (1).pdf
Python Data Types (1).pdfPython Data Types (1).pdf
Python Data Types (1).pdfNehaSpillai1
 
Python data type
Python data typePython data type
Python data typeJaya Kumari
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov
 
The Datatypes Concept in Core Python.pptx
The Datatypes Concept in Core Python.pptxThe Datatypes Concept in Core Python.pptx
The Datatypes Concept in Core Python.pptxKavitha713564
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxlemonchoos
 
Python Collections
Python CollectionsPython Collections
Python Collectionssachingarg0
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data typeswati kushwaha
 
Basic data structures in python
Basic data structures in pythonBasic data structures in python
Basic data structures in pythonCeline George
 
11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptxssuser8e50d8
 
16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks QueuesIntro C# Book
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 

Similar to Data types in python (20)

Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
Python variables and data types.pptx
Python variables and data types.pptxPython variables and data types.pptx
Python variables and data types.pptx
 
Python Data Types.pdf
Python Data Types.pdfPython Data Types.pdf
Python Data Types.pdf
 
Python Data Types (1).pdf
Python Data Types (1).pdfPython Data Types (1).pdf
Python Data Types (1).pdf
 
unit 1.docx
unit 1.docxunit 1.docx
unit 1.docx
 
Python data type
Python data typePython data type
Python data type
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4
 
The Datatypes Concept in Core Python.pptx
The Datatypes Concept in Core Python.pptxThe Datatypes Concept in Core Python.pptx
The Datatypes Concept in Core Python.pptx
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptx
 
Python Collections
Python CollectionsPython Collections
Python Collections
 
Python Session - 3
Python Session - 3Python Session - 3
Python Session - 3
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
 
types.pdf
types.pdftypes.pdf
types.pdf
 
Basic data structures in python
Basic data structures in pythonBasic data structures in python
Basic data structures in python
 
11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptx
 
Python PPT2
Python PPT2Python PPT2
Python PPT2
 
Chapter - 2.pptx
Chapter - 2.pptxChapter - 2.pptx
Chapter - 2.pptx
 
16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues
 
Python standard data types
Python standard data typesPython standard data types
Python standard data types
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 

More from RaginiJain21

Jump statment in python
Jump statment in pythonJump statment in python
Jump statment in pythonRaginiJain21
 
Conditionalstatement
ConditionalstatementConditionalstatement
ConditionalstatementRaginiJain21
 
Python media library
Python media libraryPython media library
Python media libraryRaginiJain21
 
Basic python programs
Basic python programsBasic python programs
Basic python programsRaginiJain21
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and ModulesRaginiJain21
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on pythonRaginiJain21
 

More from RaginiJain21 (7)

Jump statment in python
Jump statment in pythonJump statment in python
Jump statment in python
 
Conditionalstatement
ConditionalstatementConditionalstatement
Conditionalstatement
 
Python media library
Python media libraryPython media library
Python media library
 
Basic python programs
Basic python programsBasic python programs
Basic python programs
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
 
Python second ppt
Python second pptPython second ppt
Python second ppt
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on python
 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
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
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
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
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
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 ...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
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
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
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
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Data types in python

  • 1.
  • 2. Data types Number Sequence None Set Integer Float Complex String Tuple List Dictionary
  • 3. Number data types store numeric values. They are immutable data types, means that changing the value of a number data type results in a newly allocated object.
  • 4. There are three numeric types to present numbers- Integer Float Complex 1 2 3
  • 5. An integer is a whole number with no decimal places. For example, 1 is an integer, but 1.0 isn’t. The name for the integer data type is int. Ex- type(1) <class 'int'>
  • 6. A floating-point number, or float for short, is a number with a decimal place. 1.0 is a floating-point number, as is -2.75. Ex- type(1.0) <class 'float'>
  • 7. complex fare of the form a + bJ, where a and b are floats and J (or j) represents the square root of -1 (which is an imaginary number). The real part of the number is a, and the imaginary part is b. Complex numbers are not used much in Python programming. Ex- type(1+2j) <class 'float'>
  • 8. The None keyword is used to define a null value, or no value at all. None is not the same as 0, False, or an empty string. None is a data type of its own (NoneType) and only None can be None.
  • 9. x = None if x: print("Do you think None is True?") elif x is False: print ("Do you think None is False?") else: print("None is not True, or False, None is just None...") Output-None is not True, or False, None is just None...
  • 10. Sequences allow you to store multiple values in an organized and efficient fashion
  • 11. String are arrays of bytes representing Unicode characters. A string is a collection of one or more characters put in a single quote, double- quote or triple quote. In python there is no character data type, a character is a string of length one. It is represented by str class.
  • 12. To Access characters of String String1 = “Python" print("Initial String: ") print(String1) print("nFirst character of String is: ") print(String1[0]) Output- Initial String: Python Output- First character of String is: P
  • 13. A tuple is also a heterogeneous collection of python objects seperated by commas .It means object of different data types can consist of tuple. Ex- first_tuple=(2,3,4,6)
  • 14. Python has two built-in methods that you can use on tuples.  Count()- Returns the number of times a specified value occurs in a tuple.  Index()- Searches the tuple for a specified value and retuns the position of where it was found.
  • 15. It is a heterogeneous collection of items of varied data types. For Ex, a list object can store files in a folder or the employee data in a company etc. Ex- List=[1,2,3,4] O/P-List=[“Annu”, ”Mini”, 33, 44] //Heterogeneous collection of items
  • 16. Insert() Remove() Count() Clear() Add an element at the specified position Removes the fist item with the specified value. Returns the number of elements with the specified value. Removes all the elements from the list.
  • 17. A set is an unordered collection of unique and immutable objects. Its definition starts with enclosed braces {} having its items separated by commas inside. Creating a set- Set1={“BMW”, “Ferrari”, “Tesla”, “Ford”, ”Honda”} Set2={Honda”,”Yamaha”,”Kawasaki”,20,40}
  • 18.  Union()- Return a set that contatins all items from both sets, duplicates are excluded.  Intersection()- The intersection() method returns a set that contains the similarity between two or more sets.  Difference()- Return the difference two sets which is also a set.  Issubset()- The issubset() method returns True if all items in the items in the set exists in the specidied set, otherwise it return false.
  • 19. A dictionary in Python is an unordered collection of key-value pairs. Accessing values Print(Dict1[Roll_No]) // output Dict1[Roll_No]) : 101 Print(Dict1[‘Name’]) // output Dict1[‘Name’]) : Kajal Ex- Dict1= { “Roll_No” : 101 “Name” : “Kajal”, “Caste” : “Soni”, “Class” : 12 }
  • 20.  Get()-Returns the value of the specified key.  Update()- Updates the dictionary with the specified key-vlaue pairs.  Pop()- Removes the element with the specified key.  Copy()- Returns a copy of the dictionary.