Python tools to interact with the user
In the previous section, we saw how to get information from the user on the command line, but what do we do when we need a more dynamic form of interaction? So, let's take a look at some of Python's tools for sending information to the user and requesting information from the user.
Python's built-in functions - print and input
The fundamentals of interactivity are simple. We need to be able to tell the user things and we need the user to be able to tell us things. In service of those two goals, Python provides two built-in functions. These are print
and input
.
Create a simple.py
file with the following code:

The print
function takes any number of Python objects as parameters and prints them on the screen. The input
function takes a string prompt as its parameter, prints it out, then reads text until the user hits Enter, and returns what the user typed as a string.
Run the following command to see how the print
and input
functions work:
python3 simple.py
That...