Python Print Function

Python is one of the modern, multi-purpose, and high-level programming languages. Python is used for various purposes i.e. software development, data science, machine learning, artificial intelligence, deep learning, and back end development. More often, in any programming language, we need to print some data or string on the console. In python, we use the print () function to print the string or any kind of data on the console.

In this article, we will see how we can use the print () function in python for printing purposes.

Let’s begin this article by printing the hello world in python.

To print the Hello World in python 3, make use of the print () function as follows:

And the output is

Unlike in python 2, we do not use parenthesis with the print function. In python 2 it would be like this

And the output is

Furthermore, in this article, we will follow the python 3 syntax.

Let’s print the “Welcome to LinuxHint” by using the print function.

print(“Welcome to LinuxHint”)


Print name of the Animals

If you want to print the name of the animals, you can print in the following way:

print ("Cow")


This is the basic syntax of the print () function. We can use multiple parameters with the print function. The following are the parameters of the print () function:

  • Objects: Objects indicate the objects that are to be printed in the print () function.
  • Sep: It is used to separate the objects in the print function. We can use ‘,’ as a sep. the default value of sep is ‘’.
  • End: In python, the print function end by default with a new line ‘\n’. You can use any value to end the python print function.

Print multiple objects in one print statement

Consider the animal example that we used previously to print the name of animals. Previously we used multiple print statements to print the name of animals. In this example, we print the name of various animals in a single print statement. The animals are objects. The objects are separated by a sep which is ‘,’.

print("Cow","Dog","Cat","Lion", sep =',')

In the above line of code cow, dog, cat, and lion are the objects, and ‘,’ is a separator.


Print statement with end parameter

As we know, the print statement end with a new line by default but we can use any value to end the python print statement. We can end a line with any string or character. Python 2 does not support it.

For example, the print statement ends with ‘!’.

print ("Hello Everyone", end = ' ')
print ("Welcome to the LinuxHint", end = '!')


The print statement end with ‘@’

print ("An email must contain", end = '@')


Print blank lines

Python allows us to print the blank lines in the print () function. Sometimes we need to print the blank lines. To print the blank lines we use ‘/n’ in python.


Print 6 blank lines. You can write it as follows:

print (“\n\n\n\n\n\n”)

or you can also write it as

print (6* “\n”)

Code example

print ("Hello Everyone")
print (6*"\n")
print ("Welcome to the LinuxHint")



The print () function is used for printing the strings, objects, characters, and it is also used for debugging purposes. In this article, we have explained the python print () function and its usage with multiple examples.

About the author

Kamran Sattar Awaisi

I am a software engineer and a research scholar. I like to write article and make tutorial on various IT topics including Python, Cloud Computing, Fog Computing and Deep Learning. I love to use Linux based operating systems.