Python Data Types :
- None
- Numeric
- int (num = 2)
- float (num = 2.5)
- complex (num = 1 + 2j)
- bool (is_num = True)
- sequence
- List - [1,2,3]
- Tuple - (1,2,3)
- Set - {1,2,3}
- String - ( str = "aman" )
- Range - ( range(10) )
- map
- Dictionary - {"key":"value"}
Description in Brief
-
List
- [10,20,30]=> to store list of elements
- mutable/can update value
- used when you need to update values time to time
-
Tuple
- (1,34,56,7,89,5) => to store list of elements
- indexing from 0
- immutable/ can not update values
- good and fast while looping through of getting data as it can't be updatable
-
Set
- {23,56,78,90,54} => to store list of elements
- no indexing
- stores unique elements only no repeatation
- fast for searching as it uses hash table concept
-
Dictionary
- {"key":"value"} => store elements in key value pairs
- custom indexing
- used to deal with complex data like data inside data
Top comments (0)