Data Handling
Data Types
• Each and every value we enter in a variable have a data type
• Which is provided by python interpreter as according to data
• A=12
variable
Each value have a data type
which is stetted by python
interpreter
Data Types
• Numbers
• String
• List
• Tuples
• Dictionaries
• SET
• Boolean
Data Types:Numbers
Integer • 12,56
Float • 12.78
Complex • 12+4i
String
• Collection of characters and sequence of characters
• A=“Deepali”
• Variable should be in
• Single quotes(‘Deepali’)
• Double quotes(“Deepali”)
• Multiline values should be in
• Triple double quotes(“ “ “)
LIST
• Ordered Sequence
• Contain items
• Homogeneous (same)
• Hetrogeneous(different)
• Flexible data type
• Widely used
• Changeable(Item can be alter)
LIST declaration
• F=[1,2.0,”Deepali”]
• Items enclosed within Square brackets
• Comma (Separator)
Tuples
• Ordered Sequence
• Unchangable(Tuples can not be altered)
• Tuples uses to protect the data
• Contain items
• Homogeneous (same)
• Hetrogeneous(different)
Tuples declaration
• f=(1,2.0,”Deepali”)
• Comma(Seperator)
• Items enclosed within in parenthesis
Dictionary declaration
Contains a key : value pair
F={“Rohan”: “Cycle”,”Satyam”: “Car”}
Items enclosed with curly brackets
Comma(Seperator for key:value pair)
Dictionary
• Unordered sequence
• Contain key values pair
• Huge amount of data
• Code optimization
• Retrieve values from key
SET
• Well defined collection of item
• f={1,2.0,”Deepali”}
• Items enclosed within curly brackets
• Comma (separator)
Boolean
• True or False
• Declaration:
Bool1=True
Bool2=False

Data handling in python