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