Articles → Python → Keyboard Input From The User In Python

Keyboard Input From The User In Python






Example




name = input("Please enter your name:")
print("Welcome ", name, "!!!")




Picture showing how to take keyboard input from user in python



Getting The Integer Value From The Input Element




age = input("Please enter your age:")

print(type(age))




Picture showing the data type of the age variable as string




age = input("Please enter your age:")

print(type(eval(age)))


Picture showing the data type of the age variable as integer after using eval function



Posted By  -  Karan Gupta
 
Posted On  -  Friday, March 1, 2019
 
Updated On  -  Friday, September 17, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250