■■ Python User Input Cheat Sheet
In Python, the input() function is used to get input from the user. The input is always returned as a
string.
Usage Description Example
input("Prompt") Shows prompt and waits for user input name = input("What is your name? ")
int(input()) Get number input as integer age = int(input("Enter your age: "))
float(input()) Get decimal input price = float(input("Enter price: "))
str(input()) Get input as string (optional, default) city = str(input("City? "))
Example:
name = input("What's your name? ") print("Hello, " + name) age = int(input("How old are you? "))
print("In 5 years, you'll be", age + 5)