(Python)Why this doesnt work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

(Python)Why this doesnt work

''' Instead writing one letter at the time the program waits the sum of all letters and then prints out the word. How do I fix this? ''' from time import sleep text = "Hello world" for i in text: print(i, end="") sleep(1)

30th Nov 2018, 5:55 PM
Alex_Joo
Alex_Joo - avatar
3 Answers
+ 1
I found the solution on stockoverflow, all I ahd to do is to write: print(i, end = "", flush = True)
3rd Dec 2018, 11:28 AM
Alex_Joo
Alex_Joo - avatar
0
It's hard to say how you'd fix this without knowing where you're running it. For example, maybe the place you're running it waits for your program to finish (terminate) before showing output. I assume you're not running it here, because 11 seconds will always exceed the time limit.
30th Nov 2018, 5:59 PM
Kirk Schafer
Kirk Schafer - avatar
0
Kirk Schafer. I use Atom text editor with installed python IDE and I had issue both there and in sololearn editor. But then i tryed on original python IDLE it worked out. Is there any solution to fix thin on Atom?
3rd Dec 2018, 8:41 AM
Alex_Joo
Alex_Joo - avatar