How to print without new line (Same Line) in Python

In this tutorial, we are going to see “How to print without new line (Same Line) in Python“.  Usually, if you give print statement in python, it will be printed in lines sequentially.  For sample, please find the example below
for i in range(1,31,1):
print(i)

will give you the results from 1 to 30, single number in each new line.  If we want to have all 30 numbers in same line, it is possible to do that in Python.  The simplest idea for that is – adding ‘end’ parameter in print statement.  It will make the output in single line i.e., printing without new line or the same line.  Please find the example below.

for i in range(1,31,1):
print(i, end=”)

Output will be in same line as below:
123456789101112131415161718192021222324252627282930

We can add ‘\t’ if we want tab space in between numbers
for i in range(1,31,1):
print(i, end=’\t’)

Output for the above would be like

1     2     3  and so on.