SlideShare a Scribd company logo
2
Most read
4
Most read
5
Most read
Data Types
In Python
Prepared By;
Yatharth Chaudhary
22HCS4160
Data Types
Data type refers to the tvpe and size of data. Variables can hold values of
different data types. Python is a purely object oriented language. It refers
to everything as an object, including numbers and strings.
The five standard
data types supported
by python includes:
Number
String
List
Tuple
Dictionary
Numbers
It refers to a numeric value which includes;
• Integers
• Long Integers
• Floating Point
• Complex Numbers
Integers
In Python, integers are zero, positive or negative whole
numbers without a fractional part and having unlimited
precision, e.g. 0, 100, -10.
 Integers can be binary, octal and hexadecimal.
 All integers variables are object of the int class. Use the type() method to get the class name.
 Leading zeros in non-zero integers are not allowed, e.g. 000123 is invalid number, 0000 is 0.
 The int() function converts a string or float to int.
Float
In Python, floating point numbers (float) are positive and
negative real numbers with a fractional part denoted by the
decimal symbol . or the scientific notation E or e.
E.g. 1234.56, 3.142, -1.55, 0.23
 Floats has the maximum size depends on your system. The float beyond its maximum size
referred as "inf", "Inf", "INFINITY", or "infinity". Float 2e400 will be considered as infinity for
most systems.
 Scientific notation is used as a short representation to express floats having many digits.
E.g. 345.56789 is represented as 3.4556789e2 or 3.4556789E2
 Use the float() function to convert string, int to float.
Complex Numbers
A complex number is a number with real and imaginary components. For
example, 5 + 6j is a complex number where 5 is the real component and 6
multiplied by j is an imaginary component.
You must use j or J as imaginary component. Using other character will throw syntax error.
Boolean
 A variable of Boolean type can have one of the two values i.e. either True or False.
 The boolean value has a technical name as bool.
 The Boolean values True and False start with capital letters T and F.
 When you compare two numbers or strings, python returns the result as a Boolean
value.
 When a value evaluates to True, it’s truthy and if a value evaluates to False, it’s falsy.
 To find out if a value is True or False, you can use the bool() function.
As you can see clearly from the output, some values evaluates to True and others evaluate to False.
Example:
a = 5
print(a, "is of type", type(a))
a = 2.0
print(a, "is of type", type(a))
a = 1+2j
print(a, "is complex no.?", isinstance(1 +2j.complex))
Output:
5 is of type <class 'int>
2.0 is of type <class 'float’>
(1+2j) is complex no.? True
List
 List is an ordered sequence of items. It is one of the most
used data type in Python and is very flexible.
 All the items in a list do not need to be of the same type.
 Lists are mutable, The elements in the list can be modified
 To declare a list in python, separate the items using commas
and enclose them within square brackets[].
Tuple
Tuple is an ordered sequence of items same as list. The only
difference is that tuples are immutable. Tuples once created
cannot be modified.
It is defined within parentheses () where items are separated by
commas.
Dictionary
 A python dictionary is an unordered collection of key:value
pairs.
 Keys and values can be of any type in a dictionary.
 Items in dictionary are separated by comma and enclosed
with the curly-braces { }.
 It is very useful to retrieve data in an optimized way among a
large amount of data.
Strings
 A String in python can be a series or a sequence of alphabets,
numerals and special characters.
 The string type in Python is called str.
 Single quotes or double quotes are used to represent strings.
 Strings are immutable.
 A string in Python can contain as many characters as you wish, a string
can also be empty

More Related Content

What's hot (20)

PPTX
Variables in python
Jaya Kumari
 
PPTX
Array sorting
ALI RAZA
 
PPTX
If statements in c programming
Archana Gopinath
 
PPTX
Java Queue.pptx
vishal choudhary
 
PPTX
Python PPT
Edureka!
 
PPTX
Python presentation by Monu Sharma
Mayank Sharma
 
PPTX
Regular Expression in Compiler design
Riazul Islam
 
PDF
Python Debugging Fundamentals
cbcunc
 
PDF
Python Basics | Python Tutorial | Edureka
Edureka!
 
PPTX
Java literals
myrajendra
 
PPTX
Buffer and scanner
Arif Ullah
 
PPTX
Introduction to python
Ayshwarya Baburam
 
PPTX
Data structure - Graph
Madhu Bala
 
PPT
Operation on string presentation
Aliul Kadir Akib
 
PPTX
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
PPTX
List in Python
Siddique Ibrahim
 
PPTX
Typedef
vaseemkhn
 
PPTX
Strings in C
Kamal Acharya
 
PDF
Polish nootation
Srikanth Chennupati
 
PPTX
DBMS: Types of keys
Bharati Ugale
 
Variables in python
Jaya Kumari
 
Array sorting
ALI RAZA
 
If statements in c programming
Archana Gopinath
 
Java Queue.pptx
vishal choudhary
 
Python PPT
Edureka!
 
Python presentation by Monu Sharma
Mayank Sharma
 
Regular Expression in Compiler design
Riazul Islam
 
Python Debugging Fundamentals
cbcunc
 
Python Basics | Python Tutorial | Edureka
Edureka!
 
Java literals
myrajendra
 
Buffer and scanner
Arif Ullah
 
Introduction to python
Ayshwarya Baburam
 
Data structure - Graph
Madhu Bala
 
Operation on string presentation
Aliul Kadir Akib
 
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
List in Python
Siddique Ibrahim
 
Typedef
vaseemkhn
 
Strings in C
Kamal Acharya
 
Polish nootation
Srikanth Chennupati
 
DBMS: Types of keys
Bharati Ugale
 

Similar to Data Types In Python.pptx (20)

PPTX
2. Values and Data types in Python.pptx
deivanayagamramachan
 
PPTX
Basic data types in python
sunilchute1
 
PPTX
009 Data Handling class 11 -converted.pptx
adityakumar123456112
 
PPTX
Values and Data types in python
Jothi Thilaga P
 
PPTX
009 Data Handling .pptx
ssuser6c66f3
 
DOCX
unit 1.docx
ssuser2e84e4
 
PDF
4. Data Handling computer shcience pdf s
TonyTech2
 
PPTX
IOT notes,................................
taetaebts431
 
PPTX
Python Session - 3
AnirudhaGaikwad4
 
PDF
E-Notes_3720_Content_Document_20250107032323PM.pdf
aayushihirpara297
 
PPTX
Data_Types_in_Python_Presentation (1).pptx
KousarNadaf2
 
PPTX
Python
reshmaravichandran
 
PDF
Datatypes in Python.pdf
king931283
 
PPTX
Python PPT2
Selvakanmani S
 
PPTX
Presentation on python data type
swati kushwaha
 
PPTX
Python data type
nuripatidar
 
PDF
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
rajkumar2792005
 
PDF
Datatypes in python
eShikshak
 
PDF
Python Objects
MuhammadBakri13
 
PPTX
pythondatatypes.pptx
ArchanaAravind1
 
2. Values and Data types in Python.pptx
deivanayagamramachan
 
Basic data types in python
sunilchute1
 
009 Data Handling class 11 -converted.pptx
adityakumar123456112
 
Values and Data types in python
Jothi Thilaga P
 
009 Data Handling .pptx
ssuser6c66f3
 
unit 1.docx
ssuser2e84e4
 
4. Data Handling computer shcience pdf s
TonyTech2
 
IOT notes,................................
taetaebts431
 
Python Session - 3
AnirudhaGaikwad4
 
E-Notes_3720_Content_Document_20250107032323PM.pdf
aayushihirpara297
 
Data_Types_in_Python_Presentation (1).pptx
KousarNadaf2
 
Datatypes in Python.pdf
king931283
 
Python PPT2
Selvakanmani S
 
Presentation on python data type
swati kushwaha
 
Python data type
nuripatidar
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
rajkumar2792005
 
Datatypes in python
eShikshak
 
Python Objects
MuhammadBakri13
 
pythondatatypes.pptx
ArchanaAravind1
 
Ad

Recently uploaded (20)

PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
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
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
Dimensions of Societal Planning in Commonism
StefanMz
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
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
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
Ad

Data Types In Python.pptx

  • 1. Data Types In Python Prepared By; Yatharth Chaudhary 22HCS4160
  • 2. Data Types Data type refers to the tvpe and size of data. Variables can hold values of different data types. Python is a purely object oriented language. It refers to everything as an object, including numbers and strings.
  • 3. The five standard data types supported by python includes: Number String List Tuple Dictionary
  • 4. Numbers It refers to a numeric value which includes; • Integers • Long Integers • Floating Point • Complex Numbers
  • 5. Integers In Python, integers are zero, positive or negative whole numbers without a fractional part and having unlimited precision, e.g. 0, 100, -10.  Integers can be binary, octal and hexadecimal.
  • 6.  All integers variables are object of the int class. Use the type() method to get the class name.  Leading zeros in non-zero integers are not allowed, e.g. 000123 is invalid number, 0000 is 0.  The int() function converts a string or float to int.
  • 7. Float In Python, floating point numbers (float) are positive and negative real numbers with a fractional part denoted by the decimal symbol . or the scientific notation E or e. E.g. 1234.56, 3.142, -1.55, 0.23
  • 8.  Floats has the maximum size depends on your system. The float beyond its maximum size referred as "inf", "Inf", "INFINITY", or "infinity". Float 2e400 will be considered as infinity for most systems.  Scientific notation is used as a short representation to express floats having many digits. E.g. 345.56789 is represented as 3.4556789e2 or 3.4556789E2  Use the float() function to convert string, int to float.
  • 9. Complex Numbers A complex number is a number with real and imaginary components. For example, 5 + 6j is a complex number where 5 is the real component and 6 multiplied by j is an imaginary component. You must use j or J as imaginary component. Using other character will throw syntax error.
  • 10. Boolean  A variable of Boolean type can have one of the two values i.e. either True or False.  The boolean value has a technical name as bool.  The Boolean values True and False start with capital letters T and F.  When you compare two numbers or strings, python returns the result as a Boolean value.
  • 11.  When a value evaluates to True, it’s truthy and if a value evaluates to False, it’s falsy.  To find out if a value is True or False, you can use the bool() function. As you can see clearly from the output, some values evaluates to True and others evaluate to False.
  • 12. Example: a = 5 print(a, "is of type", type(a)) a = 2.0 print(a, "is of type", type(a)) a = 1+2j print(a, "is complex no.?", isinstance(1 +2j.complex)) Output: 5 is of type <class 'int> 2.0 is of type <class 'float’> (1+2j) is complex no.? True
  • 13. List  List is an ordered sequence of items. It is one of the most used data type in Python and is very flexible.  All the items in a list do not need to be of the same type.  Lists are mutable, The elements in the list can be modified  To declare a list in python, separate the items using commas and enclose them within square brackets[].
  • 14. Tuple Tuple is an ordered sequence of items same as list. The only difference is that tuples are immutable. Tuples once created cannot be modified. It is defined within parentheses () where items are separated by commas.
  • 15. Dictionary  A python dictionary is an unordered collection of key:value pairs.  Keys and values can be of any type in a dictionary.  Items in dictionary are separated by comma and enclosed with the curly-braces { }.  It is very useful to retrieve data in an optimized way among a large amount of data.
  • 16. Strings  A String in python can be a series or a sequence of alphabets, numerals and special characters.  The string type in Python is called str.  Single quotes or double quotes are used to represent strings.  Strings are immutable.  A string in Python can contain as many characters as you wish, a string can also be empty