11-unit1chapter03datahandling-180823043256
11-unit1chapter03datahandling-180823043256
DATA HANDLING
XI
Computer Science (083)
Board : CBSE
4.1 Unit 1:
Programming and Computational Thinking (PCT-1)
Courtesy CBSE
4.1 Unit I
Programming and Computational
Thinking (PCT-1)
(80 Theory + 70 Practical)
Prepared by
Praveen M Jigajinni
DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci)
Floating
None Data
Point
Numbers
Types
List Complex
Numbers
Tuples Strings
NUMBERS
NUMBERS
Types
Signed
Intege
rs
Bool
of eans
Integers
TYPES OF INTEGERS
(i) INTEGERS (SIGNED)
>>>bool(0)
will give result as false
>>>bool(true)
will produce 1 result.
str ( ) Function
str ( ) Function
>>>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
Fractional Exponent
Form Notation
Floating
Point
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
>>> no=5+6j
>>> type(no)
<class 'complex'>
COMPLEX NUMBERS IN PYTHON
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.
STRINGS
STRINGS
Backward Indexing
Forward Indexing
STRINGS – Programming Example
STRINGS - Example
For example:
>>>p = “Program”
>>>p [:4]
‘Prog’
Index Error!
STRINGS –Index error
MUTABLE AND IMMUTABLE OBJECTS
IN PYTHON
MUTABLE AND IMMUTABLE OBJECTS
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.
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.
What is Tuples?
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
PRECEDENCE OF AN OPERATOR
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
EXAMPLE ON
PRECEDENCE OF AN OPERATOR
PRECEDENCE OF OPERATOR EXAMPLE
PRECEDENCE OF OPERATOR EXAMPLE
Any Questions Please
THANK YOU