Make the Machine Ask You Something
Explore how to use Python's input() function to make interactive programs that ask the user questions. Learn how to capture user input as strings and convert them to numbers for calculations. This lesson helps you build your first simple Q&A program, strengthening your coding and problem-solving skills.
We'll cover the following...
We'll cover the following...
So far, we’ve been instructing Python on what to do. Now, let’s make Python ask us something!
This lesson will teach us to use the input() function to create simple, interactive programs.
Python wants to know you
Note: 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
...