Q:

Comma operator not work in Python 3

In python 2, using a comma operator at the end of the statement to print the output in horizontal line. Like this:
for i in range(5):
    print i,

And Above code would generate the following output:
0 1 2 3 4

But, in Python 3 comma operator not work to print the output in horizontal line. 
for i in range(5):
    print (i),

Generate the following output:
0
1
2
3
4

So, How to print output in horizontal line in python 3?

A:

In Python 3 you can pass the end argument to the print function to change the end of line character
for i in range(5):
    print(i, end=" ")

>> 0 1 2 3 4

