User Inputs and Outputs
The key purpose of software is to produce useful output. One simple type of output is text displaying some useful result. Python supports this with the print()
function.
The input()
function has a parallel with the print()
function. The input()
function reads text from a console, allowing us to provide data to our programs.
There are a number of other common ways to provide input to a program. Parsing the command line is helpful for many applications. We sometimes need to use configuration files to provide useful input. Data files and network connections are yet more ways to provide input. Each of these methods is distinct and needs to be looked at separately. In this chapter, we'll focus on the fundamentals of input()
and print()
.
In this chapter, we'll look at the following recipes:
- Using the features of the
print()
function - Using
input()
andgetpass()
for user input - Debugging with
f"{value=}"...