Python Print Function

The print function shows information to the user of our program. This can be useful to show the user what the program is doing when we execute it. We run the print function by specifying the function name (print) and adding parentheses after it.

Here is an example:

This tells Python to execute the function. We don’t see anything on our screen, but this produces an invisible newline character, which shows up as a blank line on your screen. This is the equivalent of hitting Enter in a text editor.

If we want to see something on our screen, we have to tell the print function what to print between the parentheses and encapsulated with quotes. For example:

When you execute this code, it shows us “Hello World”.

Unlock This Lesson for Free - No Payment Required!

If you like to keep on reading, register now!

  • Learn CCNA, CCNP and CCIE R&S. Explained As Simple As Possible.
  • Get Instant Access to this Full Lesson, Completely for Free!
  • Unlock More to Read. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)
2090 Sign Ups in the last 30 days

Ask a question or start a discussion by visiting our Community Forum