SlideShare a Scribd company logo
1 of 11
UNIT-1(Lesson 5)
Data Types - Numbers, Strings
Different Data types:
Computer programming is all about processing data. In computer programming, the
data is always represented in the binary form (0's and 1's), i.e. groups of Bits called as
Bytes.
In the real world, we come across different types of data like age of a
person(integer), number of rooms in a house (integer), price(floating-point number),
height (floating-point number), Names of people, places and things (strings),
inventory list (list) etc.
In Python data types are used to classify data to one particular type of data.
The data type of the data determines : possible values it can be assigned.
• Possible operations that can be performed. (Arithmetic operations can be
applied on numeric data and not strings)
• The format in which it is stored in the memory.
• The amount of memory allocated to store the data.
1.Some of the built-in data types supported in Python are:
Number
2.String
3.List
4.Tuple
5.Set
6.Dictionary
In Python, every value has a data type.
A variable in Python can hold value of any data type.
The same variable in Python can refer to data of different data types at different times.
So variables in Python are not (data) typed.
Select the correct statements
A. In Python, we need not specify the data type of the variable.
B. The return type of type() function is string.
C. In Python we have 'varchar' data type.
D. type() function in Python is used to know which datatype of
value the variable holds.
Numbers
We have three different categories of numbers in Python. They are :
1.int
2.float
3.complex
1.int – int stands for integer. This Python data type stores signed
integers. We can use the type() function to find which class it
belongs to.
2.float – float stands for floating-point numbers. This Python data
type stores floating-point real values. An int can only store the
number 20, but float can store numbers with decimal fractions
like 20.25 if you want.
3.complex – complex stands for complex numbers.
This Python data type stores a complex number. A complex number
is a combination of a real number and an imaginary number. It takes
the form of a + bj Here, a is the real part and b*j is the imaginary
Strings
In Python, string is a sequence of characters enclosed inside a pair of
single quotes(‘) or double quotes(“). Even triple quotes (''') are used
in Python to represent multi-line strings.
The computer doesn’t see letters at all. Every letter you use is
represented by a number in memory.
For example, the letter A is actually the number 65. This is
called encoding. There are two types of encoding for characters –
ASCII and Unicode.
ASCII uses 8 bits for encoding whereas Unicode uses 32
bits. Python uses Unicode for character representation.
An individual character within a string is accessed using an index.
Index starts from 0 to n-1, where n is the number of characters in
the string.
Python allows negative indexing in strings. The index of -1 refers to
the last item in the string, -2 refers to the second last item and so
on.
Ways of creating strings in Python :
1. Using single quotes (' ‘)
str = 'Welcome To Python World'
print(str)# will print the string
2. Using double quotes (" ")
sentence = "Welcome to Python's world"
print (sentence) # will print
3. Using triple double quotes(""" """)
We use triple double quotes(""" """) to create
multi-line strings in Python.
Select all the correct statements given
below.
A. a = 'A' is a valid character in Python.
B. str = 'Welcome to python's world' is a valid string creation.
C. Encoding means converting strings of characters into
numbers.
D. Triple quotes are used for only multi-line strings.

More Related Content

Similar to UNIT-1(Lesson 5).pptx

Data types in python
Data types in pythonData types in python
Data types in pythonRaginiJain21
 
Dr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive inputDr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive inputjalinder123
 
Dr. Rajeshree Khande Java Interactive input
Dr. Rajeshree Khande Java Interactive inputDr. Rajeshree Khande Java Interactive input
Dr. Rajeshree Khande Java Interactive inputDrRajeshreeKhande
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxlemonchoos
 
Datatypes in Python.pdf
Datatypes in Python.pdfDatatypes in Python.pdf
Datatypes in Python.pdfking931283
 
Python data type
Python data typePython data type
Python data typeJaya Kumari
 
datatypes-200723165518 (1).pptx
datatypes-200723165518 (1).pptxdatatypes-200723165518 (1).pptx
datatypes-200723165518 (1).pptxNaniBhai3
 
ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and dataSukhpreetSingh519414
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfCOMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfrajkumar2792005
 
Datatype introduction- JAVA
Datatype introduction- JAVADatatype introduction- JAVA
Datatype introduction- JAVAHamna_sheikh
 
Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in pythonsunilchute1
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumarSujith Kumar
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdfalaparthi
 
Data types in C language
Data types in C languageData types in C language
Data types in C languagekashyap399
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptxdeivanayagamramachan
 

Similar to UNIT-1(Lesson 5).pptx (20)

Data types in python
Data types in pythonData types in python
Data types in python
 
Python Session - 3
Python Session - 3Python Session - 3
Python Session - 3
 
Dr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive inputDr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive input
 
Dr. Rajeshree Khande Java Interactive input
Dr. Rajeshree Khande Java Interactive inputDr. Rajeshree Khande Java Interactive input
Dr. Rajeshree Khande Java Interactive input
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptx
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Datatypes in Python.pdf
Datatypes in Python.pdfDatatypes in Python.pdf
Datatypes in Python.pdf
 
Data types
Data typesData types
Data types
 
Python data type
Python data typePython data type
Python data type
 
DAY_1.3.pptx
DAY_1.3.pptxDAY_1.3.pptx
DAY_1.3.pptx
 
datatypes-200723165518 (1).pptx
datatypes-200723165518 (1).pptxdatatypes-200723165518 (1).pptx
datatypes-200723165518 (1).pptx
 
ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and data
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfCOMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
 
Datatype introduction- JAVA
Datatype introduction- JAVADatatype introduction- JAVA
Datatype introduction- JAVA
 
Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in python
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
Data types in C
Data types in CData types in C
Data types in C
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdf
 
Data types in C language
Data types in C languageData types in C language
Data types in C language
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx
 

Recently uploaded

Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
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
 
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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
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
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
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
 
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
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
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
 
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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
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
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

UNIT-1(Lesson 5).pptx

  • 1. UNIT-1(Lesson 5) Data Types - Numbers, Strings
  • 2. Different Data types: Computer programming is all about processing data. In computer programming, the data is always represented in the binary form (0's and 1's), i.e. groups of Bits called as Bytes. In the real world, we come across different types of data like age of a person(integer), number of rooms in a house (integer), price(floating-point number), height (floating-point number), Names of people, places and things (strings), inventory list (list) etc. In Python data types are used to classify data to one particular type of data.
  • 3. The data type of the data determines : possible values it can be assigned. • Possible operations that can be performed. (Arithmetic operations can be applied on numeric data and not strings) • The format in which it is stored in the memory. • The amount of memory allocated to store the data. 1.Some of the built-in data types supported in Python are: Number 2.String 3.List 4.Tuple 5.Set 6.Dictionary
  • 4. In Python, every value has a data type. A variable in Python can hold value of any data type. The same variable in Python can refer to data of different data types at different times. So variables in Python are not (data) typed.
  • 5.
  • 6. Select the correct statements A. In Python, we need not specify the data type of the variable. B. The return type of type() function is string. C. In Python we have 'varchar' data type. D. type() function in Python is used to know which datatype of value the variable holds.
  • 7. Numbers We have three different categories of numbers in Python. They are : 1.int 2.float 3.complex 1.int – int stands for integer. This Python data type stores signed integers. We can use the type() function to find which class it belongs to. 2.float – float stands for floating-point numbers. This Python data type stores floating-point real values. An int can only store the number 20, but float can store numbers with decimal fractions like 20.25 if you want. 3.complex – complex stands for complex numbers. This Python data type stores a complex number. A complex number is a combination of a real number and an imaginary number. It takes the form of a + bj Here, a is the real part and b*j is the imaginary
  • 8. Strings In Python, string is a sequence of characters enclosed inside a pair of single quotes(‘) or double quotes(“). Even triple quotes (''') are used in Python to represent multi-line strings. The computer doesn’t see letters at all. Every letter you use is represented by a number in memory. For example, the letter A is actually the number 65. This is called encoding. There are two types of encoding for characters – ASCII and Unicode. ASCII uses 8 bits for encoding whereas Unicode uses 32 bits. Python uses Unicode for character representation.
  • 9. An individual character within a string is accessed using an index. Index starts from 0 to n-1, where n is the number of characters in the string. Python allows negative indexing in strings. The index of -1 refers to the last item in the string, -2 refers to the second last item and so on.
  • 10. Ways of creating strings in Python : 1. Using single quotes (' ‘) str = 'Welcome To Python World' print(str)# will print the string 2. Using double quotes (" ") sentence = "Welcome to Python's world" print (sentence) # will print 3. Using triple double quotes(""" """) We use triple double quotes(""" """) to create multi-line strings in Python.
  • 11. Select all the correct statements given below. A. a = 'A' is a valid character in Python. B. str = 'Welcome to python's world' is a valid string creation. C. Encoding means converting strings of characters into numbers. D. Triple quotes are used for only multi-line strings.