SlideShare a Scribd company logo
1 of 92
CHAPTER - 03
DATA HANDLING
4.1 Unit 1:
Programming and Computational Thinking (PCT-1)
XI
Computer Science (083)
Board : CBSE
Courtesy CBSE
4.1 Unit I
Programming and Computational
Thinking (PCT-1)
(80 Theory + 70 Practical)
Praveen M Jigajinni
Prepared by
Courtesy CBSE
DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci)
Department of Computer Science, Sainik School Amaravathinagar
Cell No: 9431453730 Email – praveenkumarjigajinni@gmail.com
CHAPTER - 03
DATA HANDLING
INTRODUCTION
INTRODUCTION
Data can be of many types e.g.
character, string, integer, real etc.
Python like any other language
provides ways and facilities to handle
different types of data by providing data
types.
PYTHON DATA TYPES
PYTHON DATA TYPES
What is Data type?
DATA TYPES are means to identify
the type of data and associated
operations of handling it.
PYTHON DATA TYPES
NUMBERS
The numbers can be represented in
the python as:
(i) Integers.
(ii) Floating point Numbers.
(iii) Complex Numbers.
(i) INTEGERS
Integers numbers are whole
numbers (without any fractional part).
For example: 123,-789 etc.
TYPES OF INTEGERS
There are two types of integers:
(i) Integers (Signed).
(ii) Booleans.
Signed
Integers
Booleans
Types
of
Integers
Integers can be of any length.
Its only limited by the memory
available.
It’s a signed representation,
i.e., the integers can be positive or
negative.
(i) INTEGERS (SIGNED)
(ii) BOOLEANS
(ii) BOOLEANS
Boolean data types are the
truth values, i.e., True form or False
form.
Boolean data type is a one kind of
integer type they can be represented in
the integer form i.e., 0 and 1.
(ii) BOOLEANS
practically one can execute as
>>>bool(0)
will give result as false
>>>bool(true)
will produce 1 result.
str ( ) Function
str ( ) Function
str ( ) function coverts a value to
string type.
>>>str(false)
will give string type result ‘false’
>>>str(true)
will produce string type ‘true’ result.
(ii) FLOATING POINT NUMBERS
(ii) FLOATING POINT NUMBERS
A numbers containing
fractional part is called floating point
number.
for example: 93.452
Floating point numbers can be
written in two forms.
Note: Floating point numbers have
precision of 15 Digits( double precision)
in python.
(ii) FLOATING POINT NUMBERS
Floating
Point
Numbers
Fractional
Form
Exponent
Notation
Note: Floating point numbers have precision of
15 Digits( double precision) in python.
(ii) Advantages of Floating Point Numbers
1. They can represent range of values
between the integers.
2. They can represent a greater extent/
range of values.
Note: Floating point numbers have precision of
15 Digits( double precision) in python.
Disadvantages of Floating
Point Numbers
(ii) Disadvantages of Floating Point Numbers
Floating-point operations are
usually slower than integer operations.
Note: Floating point numbers have precision of
15 Digits( double precision) in python.
(iii) COMPLEX NUMBERS
A complex number is a number that
can be expressed in the form a + bi,
where,
a and b are real numbers, and
i is called an imaginary number.
For the complex number a + bi, a is
called the real part, and b is called
the imaginary part.
(iii) COMPLEX NUMBERS
(iii) COMPLEX NUMBERS
(iii) COMPLEX NUMBERS
(iii) COMPLEX NUMBERS
(iii) COMPLEX NUMBERS
COMPLEX NUMBERS IN PYTHON
COMPLEX NUMBERS IN PYTHON
complex number is made up of real and
imaginary parts.
Real part is a float number, and imaginary
part is any float number multiplied by
square root of -1 which is defined as j.
COMPLEX NUMBERS IN PYTHON
>>> no=5+6j
>>> no.real o/p 5.0
>>> no.imag o/p 6.0
>>> type(no)
<class 'complex'>
COMPLEX NUMBERS IN PYTHON
Python library also has complex()
function, which forms object from two
float arguments
>>> no=complex(5,6)
>>> no (5+6j)
>>> no.real o/p 5.0
>>> no.imag o/p 6.0
>>> type(no)
<class 'complex'>
Data Type Range
Data Type Range
Data Type Range
Integers Unlimited subject to
availability of memory
Booleans True ( 1 ), False ( 0 )
Floating Point
Numbers
Unlimited subject to
availability of memory
and depends on machine
architecture.
Complex Numbers Same as float type
UNICODE
What is UNICODE?
Unicode provides a unique
number for every character,
no matter what the platform,
no matter what the program,
no matter what the language.
UNICODE HISTORY
The origins of Unicode date to
1987, when Joe Becker from Xerox with Lee
Collins and Mark Davis from Apple, started
investigating the practicalities of creating a
universal character set.
UNICODE HISTORY
With additional input from Peter
Fenwick and Dave Opstad, Joe Becker
published a draft proposal for an
"international/multilingual text character
encoding system in August 1988,
tentatively called Unicode". He explained
that the name 'Unicode' is intended to
suggest a unique, unified, universal
encoding".
UNICODE HISTORY
UNICODE ADOPTION
It has been adopted by all
modern software providers and now allows
data to be transported through many
different platforms, devices and
applications without corruption.
operating systems, search engines,
browsers, laptops, and smart phones—plus
the Internet and World Wide Web (URLs,
HTML, XML, CSS, JSON, etc.) using unicode
UNICODE ADOPTION
UNICODE IMPLIMENTATION
Unicode can be
implemented by different character
encodings. The Unicode standard
defines UTF-8, UTF-16, and UTF-32, and
several other encodings are in use. The
most commonly used encodings are UTF-8,
UTF-16 and UCS-2, a precursor of UTF-16.
UNICODE IMPLIMENTATION
STRINGS
Like many other popular
programming languages, strings in
Python are arrays of bytes representing
Unicode characters. However, Python does
not have a character data type, a single
character is simply a string with a length of
1. Square brackets can be used to access
elements of the string.
STRINGS
How to create a string in Python?
How to create a string in Python?
Strings can be created by enclosing
characters inside a single quote or double
quotes. Even triple quotes can be used in
Python but generally used to represent
multiline strings and docstrings.
STRINGS
REPRESENTATION OF STRING
REPRESENTATION OF STRING
>>> s = “Hello Python”
This is how Python would index the string:
Forward Indexing
Backward Indexing
STRINGS – Programming Example
STRINGS - Example
Output Next Slide...
STRINGS - Example
How to access characters in a string?
How to access characters in a string?
We can access individual characters
using indexing and a range of characters
using slicing. Index starts from 0. Trying to
access a character out of index range will
raise an IndexError. The index must be an
integer. We can't use float or other types,
this will result into TypeError.
STRINGS
How to access characters in a string?
Python allows negative indexing for
its sequences.
The index of -1 refers to the last item,
-2 to the second last item and so on. We
can access a range of items in a string by
using the slicing operator (colon).
STRINGS
STRINGS – Programming Example
STRINGS
STRINGS
SLICING STRINGS EXAMPLES
For example:
>>>“Program”[3:5]
will result in:
‘gr ’
>>>“Program”[3:6]
will yield:
‘gra’
>>>p = “Program”
>>>p [4:]
‘ram’
>>>p = “Program”
>>>p [3:6]
‘gra’
SLICING STRINGS EXAMPLES
For example:
>>>p = “Program”
>>>p [:4]
‘Prog’
Index Error!
STRINGS –Index error
MUTABLE AND IMMUTABLE OBJECTS
IN PYTHON
What is Mutable Object?
In object-oriented programming
language , an immutable object is an object
whose state/ values can be modified after its
creation.
In short the an object / variable, for
which we can change the value is
called mutable object or mutable variable.
For example : Lists are mutable in nature.
MUTABLE AND IMMUTABLE OBJECTS
What is Immutable Object?
In object-oriented programming
language, an immutable object is an object
whose state/ values can not be modified after
it’s creation.
In short an object or a variable , for
which we can not change the value
is immutable object or immutable variable.
For example : Tupels are immutable in nature.
MUTABLE AND IMMUTABLE OBJECTS
TUPLES
TUPLES
What is Tuples?
Lists and tuples can be thought of as
generic "buckets" with which to hold an
arbitrary number of arbitrary Python objects.
TUPLES
What is Tuples or Tuple?
Tuples are the type of data it is a sequence
of immutable Python objects. Tuples are
sequences, just like lists. The differences
between tuples and lists are, the tuples cannot
be changed unlike lists and tuples use
parentheses, whereas lists use square brackets.
Creating a tuple is as simple as putting different
comma-separated values
EXAMPLES ON TUPLES
TUPLES EXAMPLE
DEFINING TUPLES WITHOUT ( )
TUPLES EXAMPLE
DEFINING TUPLES WITH ( )
TUPLES EXAMPLE – Accessing individual
elements using index number in [ ]
LISTS
A list is a data type that can be used to store
any type and number of variables and information.
Lists are mutable in nature.
General format of list is :
my_list = [item_1, item_2, item_3]
Python also allows creation of an empty list:
my_list = []
For Example
colors = ["Orange" , "red" , "Green" , "White“]
LISTS
LISTS EXAMPLE
LISTS
Note: Lists are mutable in nature.
PRECEDENCE OF AN OPERATORS
PRECEDENCE OF AN OPERATOR
Operator Description
** Exponentiation (raise to the
power)
~ + - Complement, unary plus and
minus (method names for the last
two are +@ and -@)
* / % // Multiply, divide, modulo and floor
division
Operator Description
+ - Addition and subtraction
>> << Right and left bitwise shift
& Bitwise 'AND'td>
^ | Bitwise exclusive `OR' and regular
`OR'
<= < > >= Comparison operators
<> == != Equality operators
PRECEDENCE OF AN OPERATOR
Operator Description
= %= /= //=
-= += *=
**=
Assignment operators
is is not Identity operators
in not in Membership operators
not or and Logical operators
PRECEDENCE OF AN OPERATOR
PRECEDENCE OF AN OPERATOR
EXAMPLE ON
PRECEDENCE OF OPERATOR EXAMPLE
PRECEDENCE OF OPERATOR EXAMPLE
Any Questions Please
THANK YOU

More Related Content

What's hot

What's hot (20)

11 Unit 1 Problem Solving Techniques
11  Unit 1 Problem Solving Techniques11  Unit 1 Problem Solving Techniques
11 Unit 1 Problem Solving Techniques
 
Chapter 15 Lists
Chapter 15 ListsChapter 15 Lists
Chapter 15 Lists
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
 
Python for loop
Python for loopPython for loop
Python for loop
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Python variables and data types.pptx
Python variables and data types.pptxPython variables and data types.pptx
Python variables and data types.pptx
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
 
Data types in C
Data types in CData types in C
Data types in C
 
12 SQL
12 SQL12 SQL
12 SQL
 
11 Unit1 Chapter 1 Getting Started With Python
11   Unit1 Chapter 1 Getting Started With Python11   Unit1 Chapter 1 Getting Started With Python
11 Unit1 Chapter 1 Getting Started With Python
 
Python list
Python listPython list
Python list
 
Linked list
Linked listLinked list
Linked list
 
Function in Python
Function in PythonFunction in Python
Function in Python
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Chapter 4 number system
Chapter 4 number systemChapter 4 number system
Chapter 4 number system
 

Similar to 11 Unit 1 Chapter 03 Data Handling

Similar to 11 Unit 1 Chapter 03 Data Handling (20)

Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
 
AI_2nd Lab.pptx
AI_2nd Lab.pptxAI_2nd Lab.pptx
AI_2nd Lab.pptx
 
Python
PythonPython
Python
 
python ppt | Python Course In Ghaziabad | Scode Network Institute
python ppt | Python Course In Ghaziabad | Scode Network Institutepython ppt | Python Course In Ghaziabad | Scode Network Institute
python ppt | Python Course In Ghaziabad | Scode Network Institute
 
1. python programming
1. python programming1. python programming
1. python programming
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdfpython-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
PART - 1 Python Introduction- Variables- Data types - Numeric- String- Boole...
PART - 1  Python Introduction- Variables- Data types - Numeric- String- Boole...PART - 1  Python Introduction- Variables- Data types - Numeric- String- Boole...
PART - 1 Python Introduction- Variables- Data types - Numeric- String- Boole...
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
 
Python 3.pptx
Python 3.pptxPython 3.pptx
Python 3.pptx
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
trisha comp ppt.pptx
trisha comp ppt.pptxtrisha comp ppt.pptx
trisha comp ppt.pptx
 
UNIT-1(Lesson 5).pptx
UNIT-1(Lesson 5).pptxUNIT-1(Lesson 5).pptx
UNIT-1(Lesson 5).pptx
 
DS.pptx
DS.pptxDS.pptx
DS.pptx
 
Python for Beginners(v1)
Python for Beginners(v1)Python for Beginners(v1)
Python for Beginners(v1)
 
CPPDS Slide.pdf
CPPDS Slide.pdfCPPDS Slide.pdf
CPPDS Slide.pdf
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
Python basics
Python basicsPython basics
Python basics
 

More from Praveen M Jigajinni

Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithmsPraveen M Jigajinni
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructorsPraveen M Jigajinni
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programmingPraveen M Jigajinni
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with pythonPraveen M Jigajinni
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingPraveen M Jigajinni
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow chartsPraveen M Jigajinni
 
Chapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computingChapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computingPraveen M Jigajinni
 

More from Praveen M Jigajinni (19)

Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
 
Chapter 08 data file handling
Chapter 08 data file handlingChapter 08 data file handling
Chapter 08 data file handling
 
Chapter 07 inheritance
Chapter 07 inheritanceChapter 07 inheritance
Chapter 07 inheritance
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructors
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
 
Chapter 03 python libraries
Chapter 03 python librariesChapter 03 python libraries
Chapter 03 python libraries
 
Unit 3 MongDB
Unit 3 MongDBUnit 3 MongDB
Unit 3 MongDB
 
Chapter 13 exceptional handling
Chapter 13 exceptional handlingChapter 13 exceptional handling
Chapter 13 exceptional handling
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinking
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow charts
 
Chapter 5 boolean algebra
Chapter 5 boolean algebraChapter 5 boolean algebra
Chapter 5 boolean algebra
 
Chapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computingChapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computing
 
Chapter 2 operating systems
Chapter 2 operating systemsChapter 2 operating systems
Chapter 2 operating systems
 
Chapter 1 computer fundamentals
Chapter 1 computer  fundamentalsChapter 1 computer  fundamentals
Chapter 1 computer fundamentals
 
Chapter 0 syllabus 2019 20
Chapter 0  syllabus 2019 20Chapter 0  syllabus 2019 20
Chapter 0 syllabus 2019 20
 
11 Python CBSE Syllabus
11    Python CBSE Syllabus11    Python CBSE Syllabus
11 Python CBSE Syllabus
 
11 syllabus
11    syllabus11    syllabus
11 syllabus
 

Recently uploaded

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 

Recently uploaded (20)

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 

11 Unit 1 Chapter 03 Data Handling

  • 1. CHAPTER - 03 DATA HANDLING
  • 2. 4.1 Unit 1: Programming and Computational Thinking (PCT-1) XI Computer Science (083) Board : CBSE Courtesy CBSE
  • 3. 4.1 Unit I Programming and Computational Thinking (PCT-1) (80 Theory + 70 Practical) Praveen M Jigajinni Prepared by Courtesy CBSE DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci) Department of Computer Science, Sainik School Amaravathinagar Cell No: 9431453730 Email – praveenkumarjigajinni@gmail.com
  • 4. CHAPTER - 03 DATA HANDLING
  • 6. INTRODUCTION Data can be of many types e.g. character, string, integer, real etc. Python like any other language provides ways and facilities to handle different types of data by providing data types.
  • 8. PYTHON DATA TYPES What is Data type? DATA TYPES are means to identify the type of data and associated operations of handling it.
  • 10.
  • 11. NUMBERS The numbers can be represented in the python as: (i) Integers. (ii) Floating point Numbers. (iii) Complex Numbers.
  • 12.
  • 13. (i) INTEGERS Integers numbers are whole numbers (without any fractional part). For example: 123,-789 etc.
  • 14. TYPES OF INTEGERS There are two types of integers: (i) Integers (Signed). (ii) Booleans. Signed Integers Booleans Types of Integers
  • 15.
  • 16. Integers can be of any length. Its only limited by the memory available. It’s a signed representation, i.e., the integers can be positive or negative. (i) INTEGERS (SIGNED)
  • 18. (ii) BOOLEANS Boolean data types are the truth values, i.e., True form or False form. Boolean data type is a one kind of integer type they can be represented in the integer form i.e., 0 and 1.
  • 19. (ii) BOOLEANS practically one can execute as >>>bool(0) will give result as false >>>bool(true) will produce 1 result.
  • 20. str ( ) Function
  • 21. str ( ) Function str ( ) function coverts a value to string type. >>>str(false) will give string type result ‘false’ >>>str(true) will produce string type ‘true’ result.
  • 23. (ii) FLOATING POINT NUMBERS A numbers containing fractional part is called floating point number. for example: 93.452 Floating point numbers can be written in two forms. Note: Floating point numbers have precision of 15 Digits( double precision) in python.
  • 24. (ii) FLOATING POINT NUMBERS Floating Point Numbers Fractional Form Exponent Notation Note: Floating point numbers have precision of 15 Digits( double precision) in python.
  • 25.
  • 26. (ii) Advantages of Floating Point Numbers 1. They can represent range of values between the integers. 2. They can represent a greater extent/ range of values. Note: Floating point numbers have precision of 15 Digits( double precision) in python.
  • 28. (ii) Disadvantages of Floating Point Numbers Floating-point operations are usually slower than integer operations. Note: Floating point numbers have precision of 15 Digits( double precision) in python.
  • 29.
  • 30. (iii) COMPLEX NUMBERS A complex number is a number that can be expressed in the form a + bi, where, a and b are real numbers, and i is called an imaginary number. For the complex number a + bi, a is called the real part, and b is called the imaginary part.
  • 37. COMPLEX NUMBERS IN PYTHON complex number is made up of real and imaginary parts. Real part is a float number, and imaginary part is any float number multiplied by square root of -1 which is defined as j.
  • 38. COMPLEX NUMBERS IN PYTHON >>> no=5+6j >>> no.real o/p 5.0 >>> no.imag o/p 6.0 >>> type(no) <class 'complex'>
  • 39. COMPLEX NUMBERS IN PYTHON Python library also has complex() function, which forms object from two float arguments >>> no=complex(5,6) >>> no (5+6j) >>> no.real o/p 5.0 >>> no.imag o/p 6.0 >>> type(no) <class 'complex'>
  • 41. Data Type Range Data Type Range Integers Unlimited subject to availability of memory Booleans True ( 1 ), False ( 0 ) Floating Point Numbers Unlimited subject to availability of memory and depends on machine architecture. Complex Numbers Same as float type
  • 43. What is UNICODE? Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language.
  • 45. The origins of Unicode date to 1987, when Joe Becker from Xerox with Lee Collins and Mark Davis from Apple, started investigating the practicalities of creating a universal character set. UNICODE HISTORY
  • 46. With additional input from Peter Fenwick and Dave Opstad, Joe Becker published a draft proposal for an "international/multilingual text character encoding system in August 1988, tentatively called Unicode". He explained that the name 'Unicode' is intended to suggest a unique, unified, universal encoding". UNICODE HISTORY
  • 48. It has been adopted by all modern software providers and now allows data to be transported through many different platforms, devices and applications without corruption. operating systems, search engines, browsers, laptops, and smart phones—plus the Internet and World Wide Web (URLs, HTML, XML, CSS, JSON, etc.) using unicode UNICODE ADOPTION
  • 50. Unicode can be implemented by different character encodings. The Unicode standard defines UTF-8, UTF-16, and UTF-32, and several other encodings are in use. The most commonly used encodings are UTF-8, UTF-16 and UCS-2, a precursor of UTF-16. UNICODE IMPLIMENTATION
  • 52. Like many other popular programming languages, strings in Python are arrays of bytes representing Unicode characters. However, Python does not have a character data type, a single character is simply a string with a length of 1. Square brackets can be used to access elements of the string. STRINGS
  • 53. How to create a string in Python?
  • 54. How to create a string in Python? Strings can be created by enclosing characters inside a single quote or double quotes. Even triple quotes can be used in Python but generally used to represent multiline strings and docstrings. STRINGS
  • 56. REPRESENTATION OF STRING >>> s = “Hello Python” This is how Python would index the string: Forward Indexing Backward Indexing
  • 58. STRINGS - Example Output Next Slide...
  • 60. How to access characters in a string?
  • 61. How to access characters in a string? We can access individual characters using indexing and a range of characters using slicing. Index starts from 0. Trying to access a character out of index range will raise an IndexError. The index must be an integer. We can't use float or other types, this will result into TypeError. STRINGS
  • 62. How to access characters in a string? Python allows negative indexing for its sequences. The index of -1 refers to the last item, -2 to the second last item and so on. We can access a range of items in a string by using the slicing operator (colon). STRINGS
  • 66. SLICING STRINGS EXAMPLES For example: >>>“Program”[3:5] will result in: ‘gr ’ >>>“Program”[3:6] will yield: ‘gra’ >>>p = “Program” >>>p [4:] ‘ram’ >>>p = “Program” >>>p [3:6] ‘gra’
  • 67. SLICING STRINGS EXAMPLES For example: >>>p = “Program” >>>p [:4] ‘Prog’
  • 70. MUTABLE AND IMMUTABLE OBJECTS IN PYTHON
  • 71. What is Mutable Object? In object-oriented programming language , an immutable object is an object whose state/ values can be modified after its creation. In short the an object / variable, for which we can change the value is called mutable object or mutable variable. For example : Lists are mutable in nature. MUTABLE AND IMMUTABLE OBJECTS
  • 72. What is Immutable Object? In object-oriented programming language, an immutable object is an object whose state/ values can not be modified after it’s creation. In short an object or a variable , for which we can not change the value is immutable object or immutable variable. For example : Tupels are immutable in nature. MUTABLE AND IMMUTABLE OBJECTS
  • 74. TUPLES What is Tuples? Lists and tuples can be thought of as generic "buckets" with which to hold an arbitrary number of arbitrary Python objects.
  • 75. TUPLES What is Tuples or Tuple? Tuples are the type of data it is a sequence of immutable Python objects. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets. Creating a tuple is as simple as putting different comma-separated values
  • 79. TUPLES EXAMPLE – Accessing individual elements using index number in [ ]
  • 80. LISTS
  • 81. A list is a data type that can be used to store any type and number of variables and information. Lists are mutable in nature. General format of list is : my_list = [item_1, item_2, item_3] Python also allows creation of an empty list: my_list = [] For Example colors = ["Orange" , "red" , "Green" , "White“] LISTS
  • 83. LISTS Note: Lists are mutable in nature.
  • 84. PRECEDENCE OF AN OPERATORS
  • 85. PRECEDENCE OF AN OPERATOR Operator Description ** Exponentiation (raise to the power) ~ + - Complement, unary plus and minus (method names for the last two are +@ and -@) * / % // Multiply, divide, modulo and floor division
  • 86. Operator Description + - Addition and subtraction >> << Right and left bitwise shift & Bitwise 'AND'td> ^ | Bitwise exclusive `OR' and regular `OR' <= < > >= Comparison operators <> == != Equality operators PRECEDENCE OF AN OPERATOR
  • 87. Operator Description = %= /= //= -= += *= **= Assignment operators is is not Identity operators in not in Membership operators not or and Logical operators PRECEDENCE OF AN OPERATOR
  • 88. PRECEDENCE OF AN OPERATOR EXAMPLE ON