Taking Input from the User in Python
The input() function pauses a program and waits for the user to type something, then returns whatever they typed — always as a string, regardless of what it looks like. That means numeric input needs an explicit conversion, using int() or float(), before it can be used in arithmetic.
input() displays a prompt and waits
The optional message passed to input() is shown, then the program pauses.
The user types and presses Enter
Execution resumes only once Enter is pressed.
The result is always a string
Even if the user types 42, input() returns the string "42", not the number.
Convert it to use it as a number
Wrap the result in int() or float() before doing arithmetic on it.
Multiple calls happen in sequence
Each input() call waits for its own line, one after another.
name = input("What's your name? ")age = input("How old are you? ")print(f"Hi {name}, you'll turn {int(age) + 1} next year.")Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in Python yourself — building beats watching.