Python Interactive User Input
Programs become exciting when they interact with real humans. The input() function pauses execution, prompts the user, waits for them to type something, and returns whatever they typed as a string.
"Calling input() is like handing a microphone to your user. The program politely pauses until the user finishes speaking and presses Enter."
Deep Dive: How It Works
The input() function takes an optional prompt message inside its parentheses: name = input("What is your name? ").
Crucial rule: input() ALWAYS returns a string (text), even if the user enters a number like 42.
If you need to do arithmetic with user input, you must wrap the input() call in int() or float(): age = int(input("Enter age: ")).
Syntax Blueprint
user_text = input("Prompt message: ")
user_number = int(input("Enter number: "))input() captures text from the user. Wrap in int() if you need a numeric value.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Adding numbers directly from input: total = input("N1: ") + input("N2: ")Why it happens: Because input returns strings, "5" + "5" becomes "55".
How to fix: Convert them: total = int(input("N1: ")) + int(input("N2: ")).
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Format a custom welcome banner
Create a variable called user with value "Sam".
Print "Welcome, Sam! System is ready."
Finished reading and practicing?
Mark this lesson as completed to update your course progress.