In today's session:
Data Handling
• Data types
• Operators
• Quick python codes
• Following basics are necessary to be a good
programmer
• Logic and decision making
• Understanding of Iteration
• Data Structures and Handling
Data types in python:
1. Numbers
2. String
3. List and Tuple
4. Dictionary
• Also known as built-in core data types
1. Numbers
1. Numbers
1. Integers(signed) are whole numbers. Can be positive or
negative
2. Boolean integers represent True(1) and False(0)
1. Numbers
Numbers having fractional or decimal part are called floating
point numbers.
1. Fractional form: 0.15, 3.14 etc.
2. Exponent Notation: 10.75E03, 3.145E-08
1. Numbers
Python used j instead of traditional 'i' to represent imaginary
numbers
a = 0 + 3.1j
b = 1.5 +2j
2. Strings
A string can hold any type of known characters i.e. letters,
numbers and special characters.
"abcd"
'####'
"1234abc"
2. Strings
A string is a sequence of characters, which means each character
has a position or an index.
2. Strings
2. Strings
2. Strings
2. Strings
3. List and tuples
These are compound data types with only one difference.
List once created, can be modified but tuples can't.
3. List and tuples
List: List of comma separated values on any datatype between
square brackets.
3. List and tuples
List: List of comma separated values on any datatype between
square brackets.
3. List and tuples
List: List of comma separated values on any datatype between
square brackets.
3. List and tuples
Tuple: List of comma separated values on any datatype between
parenthesis.
p=(1, 2, 3, 4, 5)
q=(2, 4, 6, 8)
r=('a', 'e', 'i', 'o')
h=(7, 8, 9, 'A', 'B')
4. Dictionary
4. Dictionary
4. Dictionary
Mutable and Immutable types
Immutable types: Non- modifiable / can never change their value
in place
p=6
q=7
r=8
Mutable and Immutable types
Immutable types: Non- modifiable / can never change their value
in place
p=6
q=7
r=8
Mutable and Immutable types
Immutable types: Non- modifiable / can never change their value
in place
p=6
q=7
r=8
p=9
q=8
r=7
Mutable and Immutable types
Mutable types: Non- modifiable / can never change their value in
place
Variable internals
Object: any entity that stores value or data is known as object in
python language
Variable internals
Object: any entity that stores value or data is known as object in
python language
Three attributes:
1. type
Variable internals
Object: any entity that stores value or data is known as object in
python language
Three attributes:
2. value
Variable internals
Object: any entity that stores value or data is known as object in
python language
Three attributes:
3. id
Operators
Operation being carried out on data, are represented by
operators.
Operators
Operation being carried out on data, are represented by
operators.
Types of operators:
1. Arithmetic operators
2. Relational operators
3. Identity operators
4. Logical operators
5. Bitwise operators
Operators
1. Arithmetic operators
Operators
2. Relational operators
Operators
3. Identity operators
Operators
3. Logical operators
Operators
5. Bitwise operators
Quick recap:
1. Numbers
2. String
3. List and Tuple
4. Dictionary
Quick recap:
1. Numbers
2. String
3. List and Tuple
4. Dictionary
Object: any entity that stores value or data is known as object
in python language
Quick recap:
1. Numbers
2. String
3. List and Tuple
4. Dictionary
Object: any entity that stores value or data is known as object
in python language
Operation being carried out on data, are represented by
Operators.
Quick questions:
What will the following code produce?
a = 8.6
b=2
print (a//b)
(a) 4.3
(b) 4.0
(c) 4
(d) error
Quick questions:
To increase the value of x five times using augmented assignment
operator, the correct expression will be
(a) x += 5
(b) x *= 5
(c) x = x ** 5
(d) none of these
Quick codes:
Quick codes:
Quick codes:
UNIT RDBMS:
Data
manupulation
using SQL
Thank you!