Collections and Sequence
Collections and Sequence#
This chapter emphases on Collections and Sequences which is used to group multiple values together – like a list of numbers, or a dictionary which can be used to store and retrieve key-value pairs.
A sequence is a group of items with a selective ordering. The order in which we put them in is the order in which we get an item out from them.
String
List
Tuples
Python collection, unlike a sequence, does not have an order. In a collection, while ordering is random, physically, they do have an order. Every time you call a set, you get its items in the same order. However, if we add or remove an item, it may affect the order.
Dictionaries
Set