Overview
input() reads a line from the user; print() writes to the screen.
Analogy
A vending machine: you type a code (input), it gives a snack (output).
Step-by-step
- name = input('Enter name: ') pauses for user text.
- User types and presses Enter; input() returns the string.
- print(f'Hello, {name}!') displays the result.
Visual
stdin → input() → variable → print() → stdout
Common mistakes
- Forgetting input() always returns a string; convert with int() for numbers.
- Missing the prompt string and confusing the user.
Practice questions
- Ask for two numbers, add them, and print the sum.
- Handle bad input with try/except ValueError.