Skip to content

TESTed judge give "Memory limit exceeded" #5234

Discussion options

You must be logged in to vote

The problem lies in the solution for the excercise with the main script and function, specifically line 26 and later:

while teller <=3:
    try:
        score_notitie_worp = input(f"Geef de score van je {teller}e worp in volgens de scorenotitie: ")

Since this is top-level code, it will always be executed, even if the test suite only has a function call (as Python will always execute top level code when a file is imported). A solution is to move the top-level code under if __name__ == '__main__':.

What happens now is the following:

  1. The submission is imported and the top-level code is run.
  2. The code attempts to read input from stdin.
  3. However, there is no stdin in this exercise, so it throws a

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by niknetniko
Comment options

You must be logged in to vote
1 reply
@niknetniko
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants