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

PDF
Datatypes in python
PPTX
Introduction to python for Beginners
PPTX
Basic data types in python
PPTX
Python variables and data types.pptx
PPTX
Python Seminar PPT
PDF
Operators in python
PDF
Python final ppt
PPT
Python Programming ppt
Datatypes in python
Introduction to python for Beginners
Basic data types in python
Python variables and data types.pptx
Python Seminar PPT
Operators in python
Python final ppt
Python Programming ppt

What's hot (20)

PPTX
Conditional and control statement
PPTX
File handling in Python
PPTX
Chapter 05 classes and objects
PPTX
Functions in python slide share
PPTX
Two dimensional arrays
PPTX
Python Exception Handling
PPTX
Functions in Python
PPTX
Python Functions
PPTX
Python strings presentation
PPTX
Class, object and inheritance in python
PDF
Python file handling
PPTX
Structure in C
PDF
Python programming : Classes objects
PPTX
Introduction to the Python
ODP
Python Modules
PPTX
Dynamic memory allocation in c
PPTX
Values and Data types in python
PDF
Python set
Conditional and control statement
File handling in Python
Chapter 05 classes and objects
Functions in python slide share
Two dimensional arrays
Python Exception Handling
Functions in Python
Python Functions
Python strings presentation
Class, object and inheritance in python
Python file handling
Structure in C
Python programming : Classes objects
Introduction to the Python
Python Modules
Dynamic memory allocation in c
Values and Data types in python
Python set
Ad

Similar to Data types in python (20)

PPTX
Python Datatypes by SujithKumar
PDF
Python Data Types.pdf
PDF
Python Data Types (1).pdf
DOCX
unit 1.docx
PPTX
Python data type
PDF
Anton Kasyanov, Introduction to Python, Lecture4
PPTX
The Datatypes Concept in Core Python.pptx
PPTX
IMP PPT- Python programming fundamentals.pptx
PPTX
Python Collections
PPTX
Python Session - 3
PPTX
Presentation on python data type
PPTX
object oriented programing in python and pip
PPTX
Basic data structures in python
PPTX
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
PPTX
11 Introduction to lists.pptx
PPTX
GRADE 11 Chapter 5 - Python Fundamentals.pptx
PPTX
Python PPT2
PPTX
Chapter - 2.pptx
PPTX
16. Arrays Lists Stacks Queues
Python Datatypes by SujithKumar
Python Data Types.pdf
Python Data Types (1).pdf
unit 1.docx
Python data type
Anton Kasyanov, Introduction to Python, Lecture4
The Datatypes Concept in Core Python.pptx
IMP PPT- Python programming fundamentals.pptx
Python Collections
Python Session - 3
Presentation on python data type
object oriented programing in python and pip
Basic data structures in python
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
11 Introduction to lists.pptx
GRADE 11 Chapter 5 - Python Fundamentals.pptx
Python PPT2
Chapter - 2.pptx
16. Arrays Lists Stacks Queues
Ad

More from RaginiJain21 (8)

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

Recently uploaded (20)

PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
PDF
Landforms and landscapes data surprise preview
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
English Language Teaching from Post-.pdf
PPTX
How to Manage Bill Control Policy in Odoo 18
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
PDF
LDMMIA Reiki Yoga S2 L3 Vod Sample Preview
PPTX
Congenital Hypothyroidism pptx
PPTX
ACUTE NASOPHARYNGITIS. pptx
PPTX
Introduction and Scope of Bichemistry.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
Types of Literary Text: Poetry and Prose
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
Landforms and landscapes data surprise preview
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
English Language Teaching from Post-.pdf
How to Manage Bill Control Policy in Odoo 18
NOI Hackathon - Summer Edition - GreenThumber.pptx
vedic maths in python:unleasing ancient wisdom with modern code
LDMMIA Reiki Yoga S2 L3 Vod Sample Preview
Congenital Hypothyroidism pptx
ACUTE NASOPHARYNGITIS. pptx
Introduction and Scope of Bichemistry.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
Module 3: Health Systems Tutorial Slides S2 2025
Types of Literary Text: Poetry and Prose
Renaissance Architecture: A Journey from Faith to Humanism
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...

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.