+ 1

How to stop default new line in print statement?

While using print statement in a loop, every time the loop after encountering with the print statement the cursor is shifted to the next line. Can I do something to avoid this. Anything that switches this escape sequence temporarily?

2nd Jan 2018, 6:07 PM
Amel
Amel - avatar
4 odpowiedzi
+ 12
print(x , end =" ") This will give the output in a single line
2nd Jan 2018, 6:10 PM
Frost
Frost - avatar
+ 4
well I think that depends on which language u use like 1. In C we have printf(); prints in the same line under the condition u are talking about unless \n is used 2.in C++ its similar to C except that we use cout and endl or \n for next line 3.in java if we use System.out.print(); we keep on getting output on the same line if we use System.out.println(); we get output in the next line
2nd Jan 2018, 6:14 PM
Infinity
Infinity - avatar
+ 4
can't comment for other languages...
2nd Jan 2018, 6:14 PM
Infinity
Infinity - avatar
0
I was asking for python.
2nd Jan 2018, 6:15 PM
Amel
Amel - avatar