0

Why is this typing delay not working?

all I get is a time limit exceeded error. is it a limitation in the sololearn playground? https://code.sololearn.com/ccorMDMBaDkw/?ref=app https://code.sololearn.com/ccorMDMBaDkw/?ref=app

30th Oct 2017, 3:08 PM
Suika Mantilla
Suika Mantilla - avatar
10 Answers
+ 4
SoloLearn. If you can compile and run on your system, you should be able to see individual characters with delay between them.
30th Oct 2017, 4:07 PM
John Wells
John Wells - avatar
+ 5
@Suika King - @John's right -- except for code that runs on your device (Web and the output from PHP), input/output is "batched". Batch processing is basically all in one unit without interaction. https://en.m.wikipedia.org/wiki/Batch_processing
30th Oct 2017, 3:59 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
John's got the answer :)
30th Oct 2017, 4:10 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
(Aside) @John: FYI, I tried fiddling with flushing in PHP too; they appear to use the same limiting system (it had no apparent effect)
30th Oct 2017, 4:14 PM
Kirk Schafer
Kirk Schafer - avatar
0
There is a runtime limit your program is allowed.
30th Oct 2017, 3:19 PM
John Wells
John Wells - avatar
0
Your program runs with 0.1 delay, but looks like output is buffered and only display after \n
30th Oct 2017, 3:22 PM
John Wells
John Wells - avatar
0
thank you for your reply! so I have taken \n out and reduced the delay to .1 however there is still not delay in the output...
30th Oct 2017, 3:40 PM
Suika Mantilla
Suika Mantilla - avatar
0
If you add more \n to output you will see more delays. The output doesn't get sent back from server until \n is seen or program exits.
30th Oct 2017, 3:43 PM
John Wells
John Wells - avatar
0
@Kirk Schafer thanks! oh I see. so it's just python's processing mode? or is it sololearn's?
30th Oct 2017, 4:05 PM
Suika Mantilla
Suika Mantilla - avatar
0
If not, there is: sys.stdout.flush(); which forces the buffer to be flushed. Unfortunately, it doesn't work here as I tried it.
30th Oct 2017, 4:12 PM
John Wells
John Wells - avatar