Junior — Middle
Which collection elements are usually used to store sequentially arranged elements?
sobes.tech AI
Answer from AI
In Python, the list collection is commonly used to store sequentially arranged elements. It is a mutable ordered data type that allows storing elements in a specific order and accessing them by index.
Example of using a list:
fruits = ['apple', 'banana', 'cherry']
print(fruits[0]) # Outputs 'apple'
fruits.append('orange') # Adds an element to the end of the list
Besides list, an immutable sequence is represented by tuple, but for storing and modifying elements, list is more frequently used.