Python print() Function

Prints a message to the screen or other standard output device.

Syntax

Python
print(values, sep = " ", end = None, file = None, flush = False)

Parameters

ParameterDescription
value Required. The values to print. They can be of any type
sep Optional. A string representing the separator to print between values. Default is " "
end Optional. The index at which to stop searching. The default is None, meaning the end of the string.
file Optional. An object with a write method, such as sys.stdout.
flush Optional. True if the output is to be flushed, False if the output is to be buffered. The default is False..

Example

Python
print('Hello World!')

Output

Hello World!

Notes

The print() function can accept any number of objects to print.

Example

Python
apples = 'Apples'
count = 5
print('I have', count, apples, sep=' ', end='!!!\n')
Output:
I have 5 Apples!!!