How to prevent long programs from failing?

I have a python code that simulates the card game War. It iterates through a set number of games and returns stats on the length of the games. It works good for <5 games but for more than that it returns "no output". Is this a memory or runtime error? If so how do you avoid it? https://code.sololearn.com/cyTk7i6qvqR0/?ref=app

3rd Dec 2019, 12:49 AM
1 Answer
+ 1
Sololearn has a strict limit on how long a program is allowed to run (5 seconds if I remember correctly). Your program would run longer the more wars it has to simulate
3rd Dec 2019, 4:49 AM
Trigger - avatar