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!
1 2 3
>>> 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) 42
You can even print
>>> print(print) <built-in function 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.