Python 3 Print Function: Purpose Explained
The print function in Python3 is used to output specified data to the console or file. It is a built-in function that can take one or more arguments as input and display them on the screen. The main purpose of the print function is:
- You can pass a string as an argument to the print function, which will print the string on the console.
- You can output the value of a variable by passing it as an argument to the print function, which will display the variable’s value on the console.
- Multiple arguments can be passed to the print function, which will print the values of these arguments in the order they are given.
- Formatted output: You can use placeholder in the print function to output formatted text in a formatted string.
- Output to file: You can redirect the output of the print function to a file instead of printing it on the console.