0
Python âtime limit exceededâ
On what does the message âtime limit exceededâ depend in Python? Is this because of the playground, the used device or the limitation due to encapsulated for-loops? https://code.sololearn.com/cIo906mB32Q8/?ref=app
6 Answers
+ 3
The innermost loop will be executed 26^5 = ca. 12 million times. If every print() takes 1 ms, the whole code will need > 3 hrs to run.
+ 2
Are you sure? Maybe if you remove the "print()". I ran your code on a PC and interrupted it after 60 seconds. The last string that was displayed was "Aayaq". Meaning there were still more than 25^2 = 625 times of all possible combinations left. 1 min * 625 > 10 hrs total execution time.
/Edit: If I remove print(), it executes in ~ 4 seconds. Millions of prints() will definitely not be done in under one minute though.
+ 1
oh. each program other than web run in SoloLearn server.
to prevent heavy burden on the server because many people use them at same time. each running program has limited time to execute.
tldr, your program take more time to finish than SoloLearn server limitation
+ 1
It's a sololearn time limitation.
I tried your program on https://repl.it/languages/python3
and it works as expected.
0
Executed in the real world the program went through in less then a minute.
0
Okay, I exchanged the print with a command to write in a file.