Skip to main content

Python: Take User Input

Most programs today use a dialog box as a way of asking the user to provide some type of input. While Python provides us with inbuilt functions to read the input from the keyboard.

We can take user input using input () method. It first takes the input from the user and then evaluates the expression, which means Python automatically identifies whether user entered a string or a number or list. If the given input  is not correct then either syntax error or exception is raised by python.

Example:

name = input("Enter Name:")
print("Name is: " + name)

Output:

Enter Name: Python
Name is: Python
Tags
Submitted by devanshi.srivastava on July 3, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.