Explain Python tuples and typical usage
Company: Reuters
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: easy
Interview Round: Technical Screen
You are asked some Python fundamentals.
1. What is a `tuple` in Python? Describe its key properties (e.g., ordering, mutability, hashability).
2. How does a tuple differ from a list in terms of:
- syntax,
- mutability and available operations,
- typical use cases,
- performance or memory characteristics?
3. Give a few concrete examples of when you would prefer to use a tuple rather than a list (for example, in function returns, as dictionary keys, or to represent fixed-size records).
Quick Answer: This question evaluates a candidate's understanding of Python tuples, covering core properties such as ordering, immutability, and hashability, and compares tuples to lists in syntax, available operations, and performance characteristics.