SlideShare a Scribd company logo
2
Most read
3
Most read
17
Most read
Data types in python
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)

PPTX
Looping statement in python
RaginiJain21
 
PPTX
Python-Inheritance.pptx
Karudaiyar Ganapathy
 
PDF
Introduction to c++ ppt
Prof. Dr. K. Adisesha
 
PPT
Array in c
Ravi Gelani
 
PPTX
Stream classes in C++
Shyam Gupta
 
PPTX
Python ppt
Anush verma
 
PPTX
Conditional and control statement
narmadhakin
 
PPTX
stack & queue
manju rani
 
ODP
Python Modules
Nitin Reddy Katkam
 
PPTX
oops concept in java | object oriented programming in java
CPD INDIA
 
PPTX
Data Structures in Python
Devashish Kumar
 
PPTX
File handling in Python
Megha V
 
PPTX
Python: Modules and Packages
Damian T. Gordon
 
PPT
ER-Model-ER Diagram
Saranya Natarajan
 
PPTX
Queue ppt
SouravKumar328
 
PDF
Class and Objects in Java
Spotle.ai
 
PDF
Python tuple
Mohammed Sikander
 
PDF
Strings in python
Prabhakaran V M
 
Looping statement in python
RaginiJain21
 
Python-Inheritance.pptx
Karudaiyar Ganapathy
 
Introduction to c++ ppt
Prof. Dr. K. Adisesha
 
Array in c
Ravi Gelani
 
Stream classes in C++
Shyam Gupta
 
Python ppt
Anush verma
 
Conditional and control statement
narmadhakin
 
stack & queue
manju rani
 
Python Modules
Nitin Reddy Katkam
 
oops concept in java | object oriented programming in java
CPD INDIA
 
Data Structures in Python
Devashish Kumar
 
File handling in Python
Megha V
 
Python: Modules and Packages
Damian T. Gordon
 
ER-Model-ER Diagram
Saranya Natarajan
 
Queue ppt
SouravKumar328
 
Class and Objects in Java
Spotle.ai
 
Python tuple
Mohammed Sikander
 
Strings in python
Prabhakaran V M
 

Similar to Data types in python (20)

PPTX
Python Datatypes by SujithKumar
Sujith Kumar
 
PDF
Python Data Types.pdf
NehaSpillai1
 
PDF
Python Data Types (1).pdf
NehaSpillai1
 
DOCX
unit 1.docx
ssuser2e84e4
 
PPTX
Python data type
Jaya Kumari
 
PDF
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov
 
PPTX
The Datatypes Concept in Core Python.pptx
Kavitha713564
 
PPTX
IMP PPT- Python programming fundamentals.pptx
lemonchoos
 
PPTX
Python Collections
sachingarg0
 
PPTX
Python Session - 3
AnirudhaGaikwad4
 
PPTX
Presentation on python data type
swati kushwaha
 
PPTX
object oriented programing in python and pip
LakshmiMarineni
 
PPTX
Basic data structures in python
Celine George
 
PPTX
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
kirtisharma7537
 
PPTX
11 Introduction to lists.pptx
ssuser8e50d8
 
PPTX
GRADE 11 Chapter 5 - Python Fundamentals.pptx
DeepaRavi21
 
PPTX
Python PPT2
Selvakanmani S
 
PPTX
Chapter - 2.pptx
MikialeTesfamariam
 
PPTX
16. Arrays Lists Stacks Queues
Intro C# Book
 
Python Datatypes by SujithKumar
Sujith Kumar
 
Python Data Types.pdf
NehaSpillai1
 
Python Data Types (1).pdf
NehaSpillai1
 
unit 1.docx
ssuser2e84e4
 
Python data type
Jaya Kumari
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov
 
The Datatypes Concept in Core Python.pptx
Kavitha713564
 
IMP PPT- Python programming fundamentals.pptx
lemonchoos
 
Python Collections
sachingarg0
 
Python Session - 3
AnirudhaGaikwad4
 
Presentation on python data type
swati kushwaha
 
object oriented programing in python and pip
LakshmiMarineni
 
Basic data structures in python
Celine George
 
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
kirtisharma7537
 
11 Introduction to lists.pptx
ssuser8e50d8
 
GRADE 11 Chapter 5 - Python Fundamentals.pptx
DeepaRavi21
 
Python PPT2
Selvakanmani S
 
Chapter - 2.pptx
MikialeTesfamariam
 
16. Arrays Lists Stacks Queues
Intro C# Book
 
Ad

More from RaginiJain21 (7)

PPTX
Jump statment in python
RaginiJain21
 
PPTX
Conditionalstatement
RaginiJain21
 
PPTX
Python media library
RaginiJain21
 
PPTX
Basic python programs
RaginiJain21
 
PPTX
Python Libraries and Modules
RaginiJain21
 
PPTX
Python second ppt
RaginiJain21
 
PPTX
Final presentation on python
RaginiJain21
 
Jump statment in python
RaginiJain21
 
Conditionalstatement
RaginiJain21
 
Python media library
RaginiJain21
 
Basic python programs
RaginiJain21
 
Python Libraries and Modules
RaginiJain21
 
Python second ppt
RaginiJain21
 
Final presentation on python
RaginiJain21
 
Ad

Recently uploaded (20)

PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Horarios de distribución de agua en julio
pegazohn1978
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 

Data types in python

  • 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.