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