Ad
  • Custom User Avatar

    You misunderstood what "unclean termination" means.

    It is a parsetime error, not a runtime error. If, after parsing, there are still whitespace characters left but they don't make up a whole instruction, or there is nothing in the code input to produce even one instruction, what do you suppose should happen?

  • Custom User Avatar

    In Python. The instructions say that I should throw an exception for unclean termination. But this code: ssstsnnstsnsssttnnstsnssstnnstsnnnnnsssntnstnnn ends during a subroutine and expects me to NOT throw an exception (I'm passing the test just finishing the program inside the subroutine); meanwhile, this one: ssstntnstntssnssstnnsssnnnn also finishes during a subroutine, but expects me to throw for "empty stack"; it has a push, a pop, and another push; it also ends during the subroutine, so it is unclean but there are no issues with the stack.

    What am I missing?

  • Custom User Avatar

    This shouldn't be a problem for decently sized numbers, but the formula for the lcm is better written as (a // math.gcd(a,b)) * b. This it uses smaller numbers.