tuple() — Python Technical Interview Questions & Answers
tuple()
tuple()
- tuple() is built into Python. You do not import it. Freshers only need one honest call and the printed result — not a long definition.
- tuple() — output: (1, 2, 3).
- Wrong type often raises TypeError. Empty values matter for bool/all/any. Don’t mix tuple up with a similar name (sorted vs sort, int vs float).
point = (3, 4) immutable
x=3 y=4Technical Interview Tip: Call tuple() once and say what prints.
Code Examples for tuple()
Example
# tuple()
print(tuple([1, 2, 3]))
tuple() — output: (1, 2, 3).
How to Explain tuple() to an Interviewer
Explain tuple() as if you are teaching a junior — definition, then one tiny script.
tuple() is built-in — no import. One call + exact output.
What does the example print, and why?
tuple() — output: (1, 2, 3)
What mistake do freshers make with tuple()?
Wrong type → TypeError.