Junior — Middle
Have you worked with tuples in your projects?
sobes.tech AI
Answer from AI
In Python, tuples are immutable sequences often used to store fixed sets of data. For example, a tuple can be used to return multiple values from a function or to store coordinates of a point.
Example of using a tuple:
point = (10, 20)
x, y = point # unpacking the tuple
print(f"X: {x}, Y: {y}")
Tuples are convenient when you need to ensure that data won't change after creation, increasing code safety and predictability.