-1

I have been learning python lately and I wanted to write a block of code that slowly prints a string. So i came up with the code below. For some reason, it just slowly prints an empty space, it just does not print the element. I wanted to write the string on the same line so that's why i added the end=" " in the print statement. but when i remove it, the elements print fine but on individual lines. And when i remove the sleep() function, the string is printed fine. What's the issue here?

str1 = list("TEST STRING: ")
for element in str1:
    print(element, end=" ")
    sleep(1)
  • "it just slowly prints an empty space, it just does not print the element. " It will print everything all at once if you wait for all of the `sleep`s to finish. Please see the linked duplicate in order to understand why and find a solution. Also: if you don't want any space between the letters, use `end=''` instead of `end=' '`. – Karl Knechtel May 27 '22 at 01:06
  • i found it worked without end just fine – Pwuurple May 27 '22 at 01:09

0 Answers0