Use built-in method input() to take User Input in Python

Mridu Bhatnagar
InstructorMridu Bhatnagar

Share this video with your friends

Send Tweet
Published 3 months ago
Updated 3 months ago

To take the user input in Python you use a built-in method input(). The data type of the user input is string. Later based on the use case the data type of the user input can be changed to a different data type based on the requirement.


>> a = input("Enter your birthday date ")
>> 31
>> a
>> '31' 
>> b = input("Enter List of numbers: ")
>> [1, 2, 3, 4]
>> b
>>  '[1, 2, 3, 4]'

NOTE: While creating the example Python interpreter is used which is why the program waits for the user to input. And, once the user enters the input then prompts the user to enter the next line of code.