...

/

Make the Machine Ask You Something

Make the Machine Ask You Something

Explore how to get user input and convert data types.

So far, we’ve been instructing Python on what to do. Now, let’s make Python ask us something!

In this lesson, we’ll learn to use the input() function to create simple, interactive programs.


Python wants to know you

After you run the widget below, you’ll be expected to enter the input. Click inside the terminal window to type your input.

name = input("What is your name? ")
print("Hello,", name)
Asking for user input and printing a response

We just had a two-way conversation with our computer!


How it works

  • input() shows a prompt and waits for the ...