0

How can we iterate in the same line?

As we use while or for loop with each time the loop runs, line breaks. I want to know how to avoid it.

3rd Jul 2018, 3:56 PM
Atul Kapisway
Atul Kapisway - avatar
2 Respostas
+ 5
If you are talking Python, the print always ends the line, unless you tell it differently. This stops it: print("test", end="") The end string gets added to the output so ", " could be used to add a comma and space.
3rd Jul 2018, 4:18 PM
John Wells
John Wells - avatar
+ 4
Place your line break outside the loop. It would be better if you post your code to get a working sample, though.
3rd Jul 2018, 4:01 PM
Hatsy Rei
Hatsy Rei - avatar