input() — Python Technical Interview Questions & Answers

input()

input()

  • input() is built into Python. You do not import it. Freshers only need one honest call and the printed result — not a long definition.
  • Output: 22. Classroom stand-in for input() so the script always runs.
  • Wrong type often raises TypeError. Empty values matter for bool/all/any. Don’t mix input up with a similar name (sorted vs sort, int vs float).

Technical Interview Tip: Call input() once and say what prints.

Code Examples for input()

Example

# input()
s = "21"
n = int(s)  # same as int(input()) in class
print(n + 1)

Output: 22. Classroom stand-in for input() so the script always runs.

How to Explain input() to an Interviewer

Explain input() as if you are teaching a junior — definition, then one tiny script.

input() is built-in — no import. One call + exact output.

What does the example print, and why?

22

What mistake do freshers make with input()?

Wrong type → TypeError.