Junior — Middle
What data types and structures have you used in your previous work?
sobes.tech AI
Answer from AI
In Python, I often used the following data types and structures:
- Lists (list) — for storing ordered collections of elements, such as a list of users or tasks.
- Dictionaries (dict) — for storing key-value pairs, such as settings or parameters.
- Sets (set) — for storing unique elements, such as unique IDs or tags.
- Tuples (tuple) — for immutable groups of data, such as coordinates or function parameters.
I also used specialized structures from the collections module, such as deque for queues with fast appending and popping from both ends, and defaultdict for convenient work with dictionaries with default values.
Example of using a dictionary and a list:
users = [
{'id': 1, 'name': 'Ivan'},
{'id': 2, 'name': 'Maria'}
]
user_dict = {user['id']: user['name'] for user in users}
print(user_dict[1]) # Outputs: Ivan