Time-based codes not simulatable in Sololearn?? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Time-based codes not simulatable in Sololearn??

I tried to test a short code in Python, just to see how time-based functions would fare in Sololearn. I got a message telling me that the time limit was exceeded. It only worked when I removed the "time.sleep" function. Here is the code: import time for each in range(100): print(each) time.sleep(1)

24th Sep 2018, 9:38 AM
Neo-Constel
Neo-Constel - avatar
4 ответов
24th Sep 2018, 9:53 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 2
what is happening here is that sleep works okay, but sololearn interpreter waits until program finish to show any output, and sololearn doesnt accept 100 seconds of wait time. if instead of 100 you put 10(or less) you should see some delay in the output compared to not waiting anything.
24th Sep 2018, 9:56 AM
Bebida Roja
Bebida Roja - avatar
+ 2
change range(100) with range(4) and it will works
24th Sep 2018, 11:08 AM
Sousou
Sousou - avatar
+ 2
Okay, I get it now... That means the output will be shown, but not in real time. I was expecting a real-time output initially, which was why. Thanks, Ulisses Cruz , Bebida Roja and Sousou.
24th Sep 2018, 12:02 PM
Neo-Constel
Neo-Constel - avatar