1.
- Lists are ordered collections of elements, which can be of any type, such as integers, strings, or even other lists. The elements in a list are accessed by their position or index, starting from zero for the first element. Lists are mutable, meaning that you can add, remove, or modify elements in place. Lists are ideal for situations where you need to store a collection of homogeneous or heterogeneous items in a specific order. On the other hand, dictionaries are unordered collections of key-value pairs, where each key is unique and maps to a specific value. The keys and values can be of any type, such as integers, strings, or other objects. Dictionaries are accessed using the key, and not by position or index. Dictionaries are also mutable, so you can add, remove, or modify key-value pairs in place. Dictionaries are ideal for situations where you need to store a collection of items, each associated with a unique identifier.
2.
- Here is the output of my own dictionary
3.
Lmk if you need to see the block of code