How to print in same line in Python

The Python's print() function is used to print the result or output to the screen. By default, it jumps to the newline to printing the next statement. It has a pre-defined format to print the output. Let's understand the following example.

Example - 1

Output:

Welcome
To
JavaTpoint

Or, we can write the complete statement in single print() function.

Output:

Welcome To JavaTpoint

The Python print() function has an argument called end, which prevents jump into the newline. Let's understand the following example.

Example - 3:

Output:

10 11 12 13 14 15

In the above code, we declared a list and iterated each element using for loop. The print() function printed the first element of the list and then printed the end value which we assigned as ' ' whitespace and it will be printed till the element of the list.

We can assign any literal to the end. Let's understand the following example.

Example - 4

Output:

10&11&12&13&14&15&





Latest Courses