The input() function in Python is used to allow a user to enter input data into the program. Once the statement containing the input function is encountered, the program pauses to wait for the user to enter something.

Syntax:
input(prompt)
copy

Where the prompt is an optional statement or query for the user that will appear on the screen. 

ExampleEdit & Run
input('Enter your name:')
copy

We can assign the value entered by the user to a variable, this value is always received as a string but we can cast it to other type if necessary. 

ExampleEdit & Run
name = input('Enter your name:')

age = input('Enter your age:')

print('%s, %s'%(name, int(age)))

nums = input("Enter comma separated values:")

L = nums.split(',')

print(L)
copy