Taking User Input in Python Language

How to Take User Input in Python

We can take user input in python using the console window or we can also create GUI using python.

To create GUI windows in Python we use a library or module called Tkinter.

To take user input in python using console window we use and built in function called:



name = input(“Enter Name”)

# Here name is the variable where we want to store of the value which user will enter in the console screen.

“Enter Name” is an instruction to user.

input() function creates string values only.

Example :

name = input(\”Enter Name\”)

pwd = input(\”Enter Password\”)


            print(\”Welcome Mohan\”)


            print(\”Your Password is correct\”)


            print(\”You are not mohan\”)

Exercise : Create a program in python to calculate the area of a triangle.

a=float(input(\”enter a in cm\”))

b=float(input(\”enter b in cm\”))

c=float(input(\”enter c in cm\”))


print(\”area is \” ,(s*(s-a)*(s-b)*(s-c))**0.5, \”cm^3\”)


Leave a Comment