Salvatore Lopiparo

Software Engineer

Super Simple Python #3 – The print Statement

You don’t have to worry about filling your printer with reams of paper yet. That’s a different kind of printing than we’re talking about. With the print function, you can do lots of cool things! Like sending strings to the console output! Exciting AND useful!

If this is your first time here, I recommend looking at the first lesson. Starting there and going through the rest of the lessons will prepare you to go through this more advanced lesson!

>>> bob_string = 'Hi, my name is Bob.'
>>> print(bob_string)
Hi, my name is Bob.

It’s that simple. You may notice that it doesn’t have quotation marks around it in the output. The quotation marks are a side effect of not using the print statement.

>>> bob_string
'Hi, my name is Bob.'

Use the print function to display the value of something to the console (the interactive PyCharm Python Console, for example). Strings by themselves won’t print to the console inside of a function definition.

You can also print numbers!

>>> print(42)

You can even print print!!

>>> print(print)

Using print is the simplest way to get feedback from your program. Use it liberally. It’s your quickest way to figure out how your program is working.


Your email address will not be published. Required fields are marked *