- 1

Python "Time limit exceeded"

I getting an "Time limit exceeded" error. Could it be because I imported random, time and os modules. The code worked fine on my system, but after I copied the code on sololearn I am getting the error?

12th Jul 2017, 5:39 AM
Luka Klaric
Luka Klaric - avatar
3 Answers
+ 4
Without your code, it's hard to guess... But anyway, Sololearn time limit is quite lesser than default time limit, as code is running on server side, they should share cpu time between all users ^^ (for example, you can test web crawling as you can import urllib and do requests, but doing more than once will reach the time limit :P) It could also be linked to the fact that there's some problem this morning for connecting the app', and a lot of spam in Discuss: maybe we are under cyber attack ;) https://www.sololearn.com/Discuss/529953/sololearn-app
12th Jul 2017, 6:03 AM
visph
visph - avatar
+ 3
Code playground cannot import 'os' and 'time' modules without reaching time limit ^^ Anyway, using os.system('clear') and/or time.sleep(n) will not have any effect in this special context with limited in/output: you must provide all required inputs at start instead at runtime, and are receiving output at once after code finish without real time display (script are running on server side)... However, your code will run if you comment the 4 lines related to this 2 modules, and provide the 6 required number as: 8 42 21 11 27 5 ... at once, on start prompt input box... but without the animated effect ;P
12th Jul 2017, 5:14 PM
visph
visph - avatar
0
Here is my code. https://code.sololearn.com/c6bCg3597G08/#py I am not sure if can open it because I didn't set it on public!
12th Jul 2017, 4:33 PM
Luka Klaric
Luka Klaric - avatar