Resumen de Otros tipos de Datos (informativo)
Requisitos de finalización
1. Datos
List | Tuple | Set | Dictionary |
List is a non-homogeneous data structure which stores the elements in single row and multiple rows and columns | Tuple is also a non-homogeneous data structure which stores single row and multiple rows and columns | Set data structure is also non-homogeneous data structure but stores in single row | Dictionary is also a non-homogeneous data structure which stores key value pairs |
List can be represented by [ ] | Tuple can be represented by ( ) | Set can be represented by { } | Dictionary can be represented by { } |
List allows duplicate elements | Tuple allows duplicate elements | Set will not allow duplicate elements | Set will not allow duplicate elements and dictionary doesn’t allow duplicate keys. |
List can use nested among all | Tuple can use nested among all | Set can use nested among all | Dictionary can use nested among all |
Example: [1, 2, 3, 4, 5] | Example: (1, 2, 3, 4, 5) | Example: {1, 2, 3, 4, 5} | Example: {1, 2, 3, 4, 5} |
List can be created using list() function | Tuple can be created using tuple() function. | Set can be created using set() function | Dictionary can be created using dict() function. |
List is mutable i.e we can make any changes in list. | Tuple is immutable i.e we can not make any changes in tuple | Set is mutable i.e we can make any changes in set. But elements are not duplicated. | Dictionary is mutable. But Keys are not duplicated. |
List is ordered | Tuple is ordered | Set is unordered | Dictionary is ordered |
Creating an empty list l=[] | Creating an empty Tuple t=() | Creating a set a=set() b=set(a) | Creating an empty dictionary d={} |