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
10 Respuestas
+ 4
SoloLearn. If you can compile and run on your system, you should be able to see individual characters with delay between them.
+ 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
+ 2
John's got the answer :)
+ 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)
0
There is a runtime limit your program is allowed.
0
Your program runs with 0.1 delay, but looks like output is buffered and only display after \n
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...
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.
0
@Kirk Schafer thanks! oh I see. so it's just python's processing mode? or is it sololearn's?
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.