I want program to print in one line but keep these two lines in code. How to do that ? I tryed to use comma but it's same
print(end1 + end2 + end3 + end4 + end5 + end6)
print(end7 + end8 + end9 + end10 + end11 + end12)
I want program to print in one line but keep these two lines in code. How to do that ? I tryed to use comma but it's same
print(end1 + end2 + end3 + end4 + end5 + end6)
print(end7 + end8 + end9 + end10 + end11 + end12)
In Python 3, you now can specify and set the end
param value to empty string in the first print statement.
print(end1 + end2 + end3 + end4 + end5 + end6, end="")
print(end7 + end8 + end9 + end10 + end11 + end12)
This is essentially your question, though slightly more involved.
The end of the answer is that appending a comma outside the printed string will allow you to put multiple print
statements on one line.
Ex):
for i in range(0,5):
print i
Will give you
0
1
2
3
4
But
for i in range(0,5):
print i,
Will give you
0 1 2 3 4
In case that doesn't work for some reason, you can always use the \b
backspace character to back out the linebreak the print whatever you want
Ex:
print("Hello")
print("\b World")