• It doesn't stop, intresting!

Question related to mission Graphical Key

 

Ok, with len (array) == 4 everything is fine, when len (array)> = 5 I have a little problem here. Everything is fine in my pycharm, but here my code produces the result, but does not stop. I thought about this, maybe this is a consequence of my 'wild' recursion, but on the other hand, after the work is done, all processes should be stopped. Any ideas?