How to avoid printing newline in Python?
Answers
Answered by
0
Answer:
Explanation:
if we use a print() function in separate lines then it will go to new line automatically.
for example:
print("num1")
print("num2")
Answered by
0
NOTE: THIS WORKS FOR PYTHON 3 ONLY.
So to avoid printing a newline in Python, all you have to do is this...
e.g: print("Hello World!", end = ' ')
What I did was that I wrote the text (in this case "Hello World") and added a comma and and end which equals to an empty string. But you have to add a space in the empty string!
And this would remove the newline.
Hope it helps.
Similar questions