From the course: Python Functions for Data Science

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Python input() function

Python input() function - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Python input() function

- [Instructor] Another useful built-in function that's fundamental in Python is input. The input function takes in a prompt, displays the prompt on the screen, allows the user to type a response to the prompt, and returns the response as a string. To illustrate how the input function is used, I'll be walking through a couple of examples. First, let's say that I want to prompt the user to enter their name and store their reply in a variable. I would do something like this. And if I want to display a response to the user using their name on the screen, I would do something like this. I'll go ahead and run this cell. If the user's name is Maxine Shaw, they would type in Maxine Shaw and press Enter. There, the user's name was stored in a variable named name and then a response to the user was displayed on the screen. Next, say that I have a dataset containing information about student's grades across five exams. I computed the…

Contents