We’ve been using the REPL so far, and the REPL automatically prints anything that is evaluated to the screen. A regular Python program will not do this though. For this reason, Python has a built in print function.
Python’s print is called by entering its name followed by parentheses. The optional arguments are listed between the parentheses, separated by commas. You can print both numbers and strings and most data types in Python. You can mix argument types, like numbers and strings when you print. In its most basic form, we can call print without any argument. In this case, it prints an empty new line. The print() function will convert special characters into something meaningful. E.g., the newline character \n turns into an actual newline, and the tab character \t will get converted into an actual tab.print() won’t escape strings like the REPL does, because we don’t want to show escaped strings to the users of our software. It’s just a convenience thing the REPL offers the programmers.
In the next lesson we will learn all about Python Booleans & Conditional Programing
Next: Lists, Tuples & Sets