Python

Print() Function

An important function that we will use throughout this course to display output

The print() function

In all programming languages, a program is typically expected to return some output. If we want to see the output on the console (terminal, command prompt, etc) we will need to incorporate the print() function. The print function works like this:

some_number = 7
print(some_number)
some_string = “this text is called a string”
print(some_string)

Output:

7
this text is called a string    

Throughout this course, we will be using this function to see the output of all the operations we perform with code. This will be very useful for testing software, but the console output of the print() function is typically not used in software that is put out for production.

chevron_up