Computer Science, asked by Vishurj3114, 1 year ago

How to avoid printing newline in Python?

Answers

Answered by kaushikpriya0304
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 Soban06
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