-1

I wrote a code using for loop that prints output on the same line. However, after executing the code a hostname displays on the same line as output. Is there any way to avoid it?

Code

list = ["h", "e", "l", "l", "o"]
for x in list:
    print(x, end='')

Ouput

hellohostname:~$

1 Answers1

0

Put print() after your loop to add a newline to the output.

timgeb
  • 76,762
  • 20
  • 123
  • 145