fork download
  1. def recursion_check(arities):
  2. b=sum(1-x for x in arities)
  3. print("There are now %d item%s in the stack."%(b,"s"[:b!=1]))
  4. if b>0:
  5. print("There is no recursion.")
  6. else:
  7. print("There is recursion.")
  8.  
  9. recursion_check([0,0,0,0,1,1,2,2,2])
  10. print("")
  11. recursion_check([0,0,0,0,1,1,2,2,2,2])
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
stdout
There are now 1 item in the stack.
There is no recursion.

There are now 0 items in the stack.
There is recursion.